drawing - OPENCV - Pixel count -


i load image in opencv. draw line point(x1,y1) point(x2,y2). how count pixels on line?

try use

int cvinitlineiterator(const cvarr* image, cvpoint pt1, cvpoint pt2, cvlineiterator* line_iterator, int connectivity=8, int left_to_right=0) 

you can find description here

"the function initializes line iterator , returns number of pixels between 2 end points. both points must inside image. after iterator has been initialized, points on raster line connects 2 ending points may retrieved successive calls of cv_next_line_point point. points on line calculated 1 one using 4-connected or 8-connected bresenham algorithm."


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -