Ransak algorithm to find line parameters of an image and draw the line

时间:2019-05-31 11:47:46

标签: python image-processing

i have these two images :

enter image description here

enter image description here

and i should use ransak algorithm to find line parameters of them and draw the best line on them.

here is an implementation of ransak algorithm:

link

the algorithm's first step is to select random data from original data, how can i use image as input?

1 个答案:

答案 0 :(得分:1)

仅需查找图像中所有非零的点即可。使用numpy.where查找所有非零的坐标。

(y, x) = np.where(img)

img是图像,假设它是灰度的。 y是行位置,x是列位置。您将使用它们来输入帖子中看到的代码。