Yukii's Blog

  • Scraps
  • V2

  1. Home
  2. Scraps
  3. cv2.HoughLines

cv2.HoughLines

cv2.Houghlines(img, rho, theta, thres)
  • (rho, theta): グリッド化する (r,θ)(r, \theta)(r,θ) の最小単位
  • thres: 投票回数の閾値

ハフ変換 の OpenCV 実装

参考: http://opencv.jp/opencv-2svn/cpp/feature_detection.html

Related Scraps:

ハフ変換

r=xcos⁡(θ)+ysin⁡(θ)r = x \cos(\theta) + y \sin(\theta)r=xcos(θ)+ysin(θ)

代表的なのは、上記式による直線の検出手法。

OpenCV

画像は、BGR 系であるとする。 一方、 Matplotlib は RGB 系を想定する。 形式変換のためには、 np.flip(img, axis=-1) を実行すると良い。

線分検知

OpenCV においては、 Line Segment Detector と houghLinesP が割と汎用的に利用できそう。

---2022/10/06

大津の二値化法

グレースケールの画像を白黒に変換したい時などに利用。 ある閾値で2つのクラスに分割するとき、クラスの分散の加重平均を最小化する手法。


© 2018-2022 Yukii