@@ -48,7 +48,6 @@ OpenCV port by: Leonardo Lontra <lhe dot lontra at gmail dot com>
48
48
*/
49
49
50
50
#include " precomp.hpp"
51
-
52
51
using namespace cv ;
53
52
using namespace std ;
54
53
@@ -79,7 +78,7 @@ class EdgeBoxesImpl : public EdgeBoxes
79
78
float gamma,
80
79
float kappa);
81
80
82
- virtual void getBoundingBoxes (InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes) CV_OVERRIDE;
81
+ virtual void getBoundingBoxes (InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes, OutputArray scores = noArray() ) CV_OVERRIDE;
83
82
84
83
float getAlpha () const CV_OVERRIDE { return _alpha; }
85
84
void setAlpha (float value) CV_OVERRIDE
@@ -910,13 +909,14 @@ void EdgeBoxesImpl::boxesNms(Boxes &boxes, float thr, float eta, int maxBoxes)
910
909
}
911
910
912
911
913
- void EdgeBoxesImpl::getBoundingBoxes (InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes)
912
+ void EdgeBoxesImpl::getBoundingBoxes (InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes, OutputArray scores )
914
913
{
915
914
CV_Assert (edge_map.depth () == CV_32F);
916
915
CV_Assert (orientation_map.depth () == CV_32F);
917
916
918
917
Mat E = edge_map.getMat ().t ();
919
918
Mat O = orientation_map.getMat ().t ();
919
+ std::vector<float > _scores;
920
920
921
921
h = E.cols ;
922
922
w = E.rows ;
@@ -931,9 +931,25 @@ void EdgeBoxesImpl::getBoundingBoxes(InputArray edge_map, InputArray orientation
931
931
// create output boxes
932
932
int n = (int ) b.size ();
933
933
boxes.resize (n);
934
+
935
+ if (scores.needed ())
936
+ {
937
+ _scores.resize (n);
938
+ }
939
+
934
940
for (int i=0 ; i < n; i++)
935
941
{
936
942
boxes[i] = Rect ((int )b[i].x + 1 , (int )b[i].y + 1 , (int )b[i].w , (int )b[i].h );
943
+ if (scores.needed ())
944
+ {
945
+ _scores[i] = b[i].score ;
946
+ }
947
+ }
948
+
949
+ // return scores if asked for
950
+ if (scores.needed ())
951
+ {
952
+ Mat (_scores).copyTo (scores);
937
953
}
938
954
}
939
955
0 commit comments