1 | initial version |
Make a copy at each iteration of your image and draw on that copy.
cv::Mat orig, result;
orig=imread("image.jpg");
while(1) {
orig.copyTo(result); //make a new copy of the original image
Rect detection=processimage(orig); //here you put the processing that returns some result.
cv::rectangle(result,detection,cv::Scalar(0,0,0)); //draw the result to the copy of the image
cv::imshow("Result",result); // display it
cv::waitKey();
}