Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

since you calculate the flow on your "large" image, the point coords are not related to your ROI.

try without adding your Point pt1:

for (int y=0; y<roi.rows; y+=5) {
    for (int x=0;x<roi.cols;x+=5) {
        const Point2f& flowatxy=flow.at<Point2f>(y,x);
        line(Image, Point(x,y),
                    Point(cvRound(x+flowatxy.x), cvRound(y+flowatxy.y)), Scalar(0,255,0));
    }
}