As far as I have understood your problem...If your gray image is frameg
then the following API produces the image with edges..
Canny(frameg,frameEdge,50,150,3,false);
where frameEdge
is the image containing the edges. frameEdge
is a binary image with edge pixels being white (255) and the other pixels are black(0).
for(int r = 0;r<frameEdge.rows;r++)
{
for(int c=0;c<frameEdge.cols;c++)
{
if( *(frameEdge.data + frameEdge.cols*r + c) == (uchar)255 )
{
Point edgepixel;
edgepixel.x = c; edgepixel.y = r;
myedges.push_back(edgepixel);
}
}
}
So you can easily scan the image and find the white pixels ans store their locations. That way you find the edge pixels. Make a an array vector<Point> myedges
to store the edge pixel locations. Do this for each frame in your video and do the necessary comparisons. Note : I have taken the images as cv::Mat
. You can use IplImage
also.