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 23, 2024
1 parent a00b3f3 commit 80d4688
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 74 deletions.
21 changes: 0 additions & 21 deletions modules/fastcv/include/opencv2/fastcv/hough.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,6 @@ namespace fastcv {
*/
CV_EXPORTS_W void houghLines(InputArray src, OutputArray lines, double threshold = 0.25);


/**
* @brief Finds circles in a grayscale image using Hough transform.
* The radius of circle varies from 0 to max(srcWidth, srcHeight).
*
* @param src Input 8-bit image containing binary contour. Step should be divisible by 8, data start should be 128-bit aligned
* @param circles Output array containing detected circles in a form (x, y, r) where all numbers are 32-bit integers
* @param minDist Minimum distance between the centers of the detected circles
* @param cannyThreshold The higher threshold of the two passed to the Canny() edge detector
* (the lower one is twice smaller). Default is 100.
* @param accThreshold The accumulator threshold for the circle centers at the detection
* stage. The smaller it is, the more false circles may be detected.
* Circles, corresponding to the larger accumulator values, will be
* returned first. Default is 100.
* @param minRadius Minimum circle radius, default is 0
* @param maxRadius Maximum circle radius, default is 0
*/
CV_EXPORTS_W void houghCircles(InputArray src, OutputArray circles, uint32_t minDist,
uint32_t cannyThreshold = 100, uint32_t accThreshold = 100,
uint32_t minRadius = 0, uint32_t maxRadius = 0);

//! @}

} // fastcv::
Expand Down
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/include/opencv2/fastcv/thresh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace fastcv {
* @param falseValue The value assigned to the destination pixel if the source is out of the range inclusively defined by the
* pair of threshold values
*/
CV_EXPORTS_W void thresholdRange(InputArray src, OutputArray dst, uint8_t lowThresh, uint8_t highThresh, uint8_t trueValue, uint8_t falseValue);
CV_EXPORTS_W void thresholdRange(InputArray src, OutputArray dst, int lowThresh, int highThresh, int trueValue, int falseValue);

//! @}

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::
7 changes: 6 additions & 1 deletion modules/fastcv/src/thresh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
namespace cv {
namespace fastcv {

void thresholdRange(InputArray _src, OutputArray _dst, uint8_t lowThresh, uint8_t highThresh, uint8_t trueValue, uint8_t falseValue)
void thresholdRange(InputArray _src, OutputArray _dst, int lowThresh, int highThresh, int trueValue, int falseValue)
{
INITIALIZATION_CHECK;

CV_Assert(lowThresh >= 0 && lowThresh < 256);
CV_Assert(highThresh >= 0 && highThresh < 256);
CV_Assert(falseValue >= 0 && falseValue < 256);
CV_Assert(trueValue >= 0 && trueValue < 256);

CV_Assert(lowThresh <= highThresh);

CV_Assert(!_src.empty() && _src.type() == CV_8UC1);
Expand Down
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 80d4688

Please sign in to comment.