Detect if a pixel in an RGB image belongs to a line between two other pixels (MATLAB)

I have a problem in my matlab project

I have a RGB color image and I have two specified pixels (x1, y1) and (x2, y2) I want to check every pixel in the image and determine if the pixel of the line belongs between (x1, y1) and (x2, y2 )

I tried to use these functions

m = (y2-y1) / (x2-x1); b = y1 - m * x1; if (y == m * x + b), then TRUE

but it almost doesn't work

Does anyone have another way to solve it? you are welcome,

thank

+3
source share
2 answers

, . , , - " "

, , ,

if abs(m*x+b -y) < tolerance  

+2

, , , .

+2

Source: https://habr.com/ru/post/1774275/


All Articles