Skip to content

Commit

Permalink
Fixed Java and Python bindings generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
asmorkalov committed Dec 20, 2024
1 parent a7b9959 commit 453b55a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 51 deletions.
30 changes: 15 additions & 15 deletions modules/fastcv/include/opencv2/fastcv/mser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class CV_EXPORTS_W FCVMSER
Typical value range [0.1 1.0], typical value 0.2
* @return Feature detector object ready for detection
*/
CV_WRAP static Ptr<FCVMSER> create( cv::Size imgSize,
uint32_t numNeighbors = 4,
uint32_t delta = 2,
uint32_t minArea = 30,
uint32_t maxArea = 14400,
float maxVariation = 0.15f,
float minDiversity = 0.2f);
CV_WRAP static Ptr<FCVMSER> create( const cv::Size& imgSize,
int numNeighbors = 4,
int delta = 2,
int minArea = 30,
int maxArea = 14400,
float maxVariation = 0.15f,
float minDiversity = 0.2f);

/**
* @brief This is an overload for detect() function
Expand Down Expand Up @@ -95,15 +95,15 @@ class CV_EXPORTS_W FCVMSER
* @param contourData Array containing additional information about found contours
*/
virtual void detect(InputArray src, std::vector<std::vector<Point>>& contours, std::vector<cv::Rect>& boundingBoxes,
std::vector<ContourData>& contourData) = 0;
std::vector<ContourData>& contourData) = 0;

CV_WRAP virtual cv::Size getImgSize() = 0;
CV_WRAP virtual uint32_t getNumNeighbors() = 0;
CV_WRAP virtual uint32_t getDelta() = 0;
CV_WRAP virtual uint32_t getMinArea() = 0;
CV_WRAP virtual uint32_t getMaxArea() = 0;
CV_WRAP virtual float getMaxVariation() = 0;
CV_WRAP virtual float getMinDiversity() = 0;
CV_WRAP virtual cv::Size getImgSize() = 0;
CV_WRAP virtual int getNumNeighbors() = 0;
CV_WRAP virtual int getDelta() = 0;
CV_WRAP virtual int getMinArea() = 0;
CV_WRAP virtual int getMaxArea() = 0;
CV_WRAP virtual float getMaxVariation() = 0;
CV_WRAP virtual float getMinDiversity() = 0;

virtual ~FCVMSER() {}
};
Expand Down
2 changes: 1 addition & 1 deletion modules/fastcv/perf/perf_mser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PERF_TEST_P(MSERPerfTest, run,

cv::Ptr<cv::fastcv::FCVMSER> mser;
mser = cv::fastcv::FCVMSER::create(src.size(), numNeighbors, delta, minArea, maxArea,
maxVariation, minDiversity);
maxVariation, minDiversity);

while(next())
{
Expand Down
69 changes: 35 additions & 34 deletions modules/fastcv/src/mser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ class MSER_Impl CV_FINAL : public cv::fastcv::FCVMSER
{
public:
explicit MSER_Impl(cv::Size imgSize,
uint32_t numNeighbors,
uint32_t delta,
uint32_t minArea,
uint32_t maxArea,
float maxVariation,
float minDiversity);
int numNeighbors,
int delta,
int minArea,
int maxArea,
float maxVariation,
float minDiversity);

~MSER_Impl() CV_OVERRIDE;

cv::Size getImgSize() CV_OVERRIDE { return imgSize; };
uint32_t getNumNeighbors() CV_OVERRIDE { return numNeighbors; };
uint32_t getDelta() CV_OVERRIDE { return delta; };
uint32_t getMinArea() CV_OVERRIDE { return minArea; };
uint32_t getMaxArea() CV_OVERRIDE { return maxArea; };
float getMaxVariation() CV_OVERRIDE { return maxVariation; };
float getMinDiversity() CV_OVERRIDE { return minDiversity; };
cv::Size getImgSize() CV_OVERRIDE { return imgSize; };
int getNumNeighbors() CV_OVERRIDE { return numNeighbors; };
int getDelta() CV_OVERRIDE { return delta; };
int getMinArea() CV_OVERRIDE { return minArea; };
int getMaxArea() CV_OVERRIDE { return maxArea; };
float getMaxVariation() CV_OVERRIDE { return maxVariation; };
float getMinDiversity() CV_OVERRIDE { return minDiversity; };

void detect(InputArray src, std::vector<std::vector<Point>>& contours) CV_OVERRIDE;
void detect(InputArray src, std::vector<std::vector<Point>>& contours, std::vector<cv::Rect>& boundingBoxes) CV_OVERRIDE;
Expand All @@ -42,24 +42,24 @@ class MSER_Impl CV_FINAL : public cv::fastcv::FCVMSER
bool useContourData = true);

cv::Size imgSize;
uint32_t numNeighbors;
uint32_t delta;
uint32_t minArea;
uint32_t maxArea;
float maxVariation;
float minDiversity;
int numNeighbors;
int delta;
int minArea;
int maxArea;
float maxVariation;
float minDiversity;

void *mserHandle;
};


MSER_Impl::MSER_Impl(cv::Size _imgSize,
uint32_t _numNeighbors,
uint32_t _delta,
uint32_t _minArea,
uint32_t _maxArea,
float _maxVariation,
float _minDiversity)
MSER_Impl::MSER_Impl(cv::Size _imgSize,
int _numNeighbors,
int _delta,
int _minArea,
int _maxArea,
float _maxVariation,
float _minDiversity)
{
CV_Assert(_imgSize.width > 50);
CV_Assert(_imgSize.height > 5);
Expand Down Expand Up @@ -244,16 +244,17 @@ void MSER_Impl::detect(InputArray src, std::vector<std::vector<Point>>& contours
this->detectRegions(src, contours, boundingBoxes, contourData, /*useBoundingBoxes*/ true, /*useContourData*/ true);
}

Ptr<FCVMSER> FCVMSER::create(cv::Size imgSize,
uint32_t numNeighbors,
uint32_t delta,
uint32_t minArea,
uint32_t maxArea,
float maxVariation,
float minDiversity)
Ptr<FCVMSER> FCVMSER::create(const cv::Size& imgSize,
int numNeighbors,
int delta,
int minArea,
int maxArea,
float maxVariation,
float minDiversity)
{
CV_Assert(numNeighbors > 0 && delta >= 0 && minArea >= 0 && maxArea >= 0);
return makePtr<MSER_Impl>(imgSize, numNeighbors, delta, minArea, maxArea, maxVariation, minDiversity);
}

} // fastcv::
} // cv::
} // cv::
2 changes: 1 addition & 1 deletion modules/fastcv/test/test_mser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ INSTANTIATE_TEST_CASE_P(FastCV_Extension, MSERTest,
::testing::Values("cv/shared/baboon.png", "cv/mser/puzzle.png")
)
);
}} // namespaces opencv_test, ::
}} // namespaces opencv_test, ::

0 comments on commit 453b55a

Please sign in to comment.