Gapi HoughCircle

Hi all,
if I’m not mistaken HoughCircles is not available through the G-API.
Is there a plan for that to be added or possible workaround (e.g. implementing from scratch)?

cheers

Hey @cooked ,

Like almost any OpenCV function, in your app HoughCircles can be added using a custom kernel (e.g., via GAPI_OCV_KERNEL).

I believe it may look like this:

using GCircles = cv::GArray<cv::Vec3f>;
G_API_OP(GHoughCircles, <GCircles(cv::GMat, int, double, double, double, double, int, int)>, "org.opencv.imgproc.hough_circles") {
    cv::GArrayDesc outMeta(cv::GMatDesc, int, double, double, double, double, int, int) {
        return cv::empty_array_desc();
    }
};

GAPI_OCV_KERNEL(GOCVHoughCircles, GHoughCircles) {
    static void run(cv::Mat input, int method, double dp, double minDist, double p1, double p2, int minR, int maxR, std::vector<cv::Vec3f> &out) {
        cv::HoughCircles(input, out, method, dp, minDist, p1, p2, minR, maxR);
    } 
};

More information on defining kernels: OpenCV: Kernel API