Something worng using LineIterator [closed]
Hi all: I don't know happens using lielterator.The value of the variable buf[0]=47.Why???? Someone could tell me??? Thanks.
Original image:
Hi all: I don't know happens using lielterator.The value of the variable buf[0]=47.Why???? Someone could tell me??? Thanks.
Original image:
Asked: 2013-05-21 11:34:31 -0600
Seen: 778 times
Last updated: May 21 '13
what exactly do you think is wrong here ?
it should be the pixel value for cp2.
Deae berak: cp2 is locations point(31,46),cp1 is locations pont(101,36), it's from pure black to pure white. so the data of the buf should be 0,0,....0,255,255,255,,,,,255.isn't.The code in the picture "LineIterator it(Img,cp2,cp1,4,false);" should be "LineIterator it(temp,cp2,cp1,4,false);"But I can't get correct the pixel of the line.
oh, right.
well, you're converting to grayscale(temp), but you're applying the LineIterator to the bgr-image (Img) is that intended ? should be iterating over Vec3b pixels then. (not that it would change the numbers, though)
Dear berak:i convert to gray. And i want to get the line in the gray piexl. so the code i change: if(Img.type()==CV_8UC1) { temp=Img; } else { cv::cvtColor(Img,temp,CV_BGR2GRAY); }
But,unfortunatly,in some cases i get correct piexl, some cases are not. I try to convert BGR again.
I think it's Ok when gray image,using:
buf[i]=(const uchar) *it.ptr; & color image using: buf[i] =(const Vec3b) it.ptr[0]; thanks:)