工作好きな情報系の雑記

[OpenCV] It's better to use a minimum circumscribed circle than to use Hough Circle Transform for circle detection

This is a tip I found when I tried to detect a red ball.

One of the popular methods is using Hough Circle Transform.
This method is difficult to explain, so I list some references.↓↓

However, the Hough transform is heavy, slow, and inaccurate. Besides, the size of the detected circle is not stable.

I was wondering how to deal with it, then an experienced friend told me that "it is better to use a minimum circumscribed circle".
I actually used it, and I found it was much more accurate (it doesn't mean truly accurate, though) and smooth.
it would be more accurate to say that it seems to recognize circles with good accuracy because it's actually not recognizing circles. It only detects certain colors, so the detection is fast and accurate.

I recognized a red ball displayed on my smartphone as a demo.
It seems good, isn't it?

Of course, there are cases of the Hough Circle Transform is a suitable choice, but this time I want to recognize only one red ball, so using the minimum circumscribed circle was comfortable enough.

An example code is shown below.

Everyone, let's use the minimum circumscribed circle!

輪郭に関するチュートリアル OpenCVにおける輪郭(領域) — OpenCV-Python Tutorials 1 documentation 輪郭抽出 OpenCVの輪郭検出は,黒い背景から白い物体の輪郭を検出すると仮定しています.物体は白(明るい色),背景は黒(暗い色)と覚えておいてください. とある。 cv2.findContours 輪郭抽出と、その輪郭に対する処理を人多りやてみる。 void findContours(const Mat& image, vector& contours, int mode, int method, Point off…
opencv チュートリアルチャレンジ9 OpenCVにおける輪郭(領域) - 機械学習備忘録 - 機械学習備忘録
モバイルバージョンを終了