Commit 8acc8aaf authored by Alexander Alekhin's avatar Alexander Alekhin

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

parents 5b434d3c fc979a85
...@@ -74,8 +74,9 @@ public: ...@@ -74,8 +74,9 @@ public:
@param edge_map edge image. @param edge_map edge image.
@param orientation_map orientation map. @param orientation_map orientation map.
@param boxes proposal boxes. @param boxes proposal boxes.
@param scores of the proposal boxes, provided a vector of float types.
*/ */
CV_WRAP virtual void getBoundingBoxes(InputArray edge_map, InputArray orientation_map, CV_OUT std::vector<Rect> &boxes) = 0; CV_WRAP virtual void getBoundingBoxes(InputArray edge_map, InputArray orientation_map, CV_OUT std::vector<Rect> &boxes, OutputArray scores = noArray()) = 0;
/** @brief Returns the step size of sliding window search. /** @brief Returns the step size of sliding window search.
*/ */
......
...@@ -48,7 +48,6 @@ OpenCV port by: Leonardo Lontra <lhe dot lontra at gmail dot com> ...@@ -48,7 +48,6 @@ OpenCV port by: Leonardo Lontra <lhe dot lontra at gmail dot com>
*/ */
#include "precomp.hpp" #include "precomp.hpp"
using namespace cv; using namespace cv;
using namespace std; using namespace std;
...@@ -79,7 +78,7 @@ public: ...@@ -79,7 +78,7 @@ public:
float gamma, float gamma,
float kappa); float kappa);
virtual void getBoundingBoxes(InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes) CV_OVERRIDE; virtual void getBoundingBoxes(InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes, OutputArray scores = noArray()) CV_OVERRIDE;
float getAlpha() const CV_OVERRIDE { return _alpha; } float getAlpha() const CV_OVERRIDE { return _alpha; }
void setAlpha(float value) CV_OVERRIDE void setAlpha(float value) CV_OVERRIDE
...@@ -910,13 +909,14 @@ void EdgeBoxesImpl::boxesNms(Boxes &boxes, float thr, float eta, int maxBoxes) ...@@ -910,13 +909,14 @@ void EdgeBoxesImpl::boxesNms(Boxes &boxes, float thr, float eta, int maxBoxes)
} }
void EdgeBoxesImpl::getBoundingBoxes(InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes) void EdgeBoxesImpl::getBoundingBoxes(InputArray edge_map, InputArray orientation_map, std::vector<Rect> &boxes, OutputArray scores)
{ {
CV_Assert(edge_map.depth() == CV_32F); CV_Assert(edge_map.depth() == CV_32F);
CV_Assert(orientation_map.depth() == CV_32F); CV_Assert(orientation_map.depth() == CV_32F);
Mat E = edge_map.getMat().t(); Mat E = edge_map.getMat().t();
Mat O = orientation_map.getMat().t(); Mat O = orientation_map.getMat().t();
std::vector<float> _scores;
h = E.cols; h = E.cols;
w = E.rows; w = E.rows;
...@@ -931,9 +931,25 @@ void EdgeBoxesImpl::getBoundingBoxes(InputArray edge_map, InputArray orientation ...@@ -931,9 +931,25 @@ void EdgeBoxesImpl::getBoundingBoxes(InputArray edge_map, InputArray orientation
// create output boxes // create output boxes
int n = (int) b.size(); int n = (int) b.size();
boxes.resize(n); boxes.resize(n);
if (scores.needed())
{
_scores.resize(n);
}
for(int i=0; i < n; i++) for(int i=0; i < n; i++)
{ {
boxes[i] = Rect((int)b[i].x + 1, (int)b[i].y + 1, (int)b[i].w, (int)b[i].h); boxes[i] = Rect((int)b[i].x + 1, (int)b[i].y + 1, (int)b[i].w, (int)b[i].h);
if (scores.needed())
{
_scores[i] = b[i].score;
}
}
// return scores if asked for
if (scores.needed())
{
Mat(_scores).copyTo(scores);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment