Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Load images to crop automatically

Hello, I have like 10 images and need to be cropped. What I can do right now is I can load-crop-save the image one by one.

Next i'll have like thousands of images which i think could take me sometimes to do one by one. Im thinking of using the for loop but looks like i received the error string to int conversion which i could not understand.

here is my code... the problem is to load the image automatically with the different at the postfix using number increment i.e. image0, image1, image2 and so on.

for( int i = 0; i < 12000; i = i + 1 )
image = imread(("C://BITWISE//Image%d.jpg",a), CV_LOAD_IMAGE_COLOR);   
Mat croppedImage = image(myROI);
cv::imwrite( cv::format( "C:/BITWISE/Croped%d.jpg",i), croppedImage ); 

waitKey(0);                                          // Wait for a keystroke in the window
return 0;


appreciate on your help