0

i am able to detect text areas in an image and i am marking those areas by rectangle.I followed the link text extraction from image to do this. Can anyone suggest a way I can crop the detected areas?

Community
  • 1
  • 1
shre
  • 1
  • 2

1 Answers1

2

You can use following code to crop the image;

Rect roi(r.x, r.y, r.width, r.height);
Mat image_roi = image(roi);
image_roi.copyTo(cropimage);
imwrite("cropimage.jpg",image_roi);
Rahul galgali
  • 775
  • 2
  • 10
  • 26
  • i am getting the whole text area as the output, is there some way by which i can get each letter segmented in an image? – shre Mar 26 '15 at 13:27
  • For that you need to find each letter and then get bounding rect of the letter and crop as per above procedure. This looks somewhat similar to your problem :http://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python – Rahul galgali Mar 26 '15 at 13:48