1 | initial version |
you can't crop & save the rotatedrect directly (it's not axis-aligned), but you can save it's boundingRect:
Rect r = rrect.boundingRect();
Mat crop = rgb(r);
imsave(format("letters_%d.png", idx), crop);
2 | No.2 Revision |
you can't crop & save the rotatedrect directly (it's not axis-aligned), but you can save it's boundingRect:
Rect r = rrect.boundingRect();
Mat crop = rgb(r);
imsave(format("letters_%d.png", imsave(format("letters_%04d.png", idx), crop);
3 | No.3 Revision |
you can't crop & save the rotatedrect directly (it's not axis-aligned), but you can save it's boundingRect:
Rect r = rrect.boundingRect();
Mat crop = rgb(r);
imsave(format("letters_%04d.png", imwrite(format("letters_%04d.png", idx), crop);
4 | No.4 Revision |
you can't crop & save the rotatedrect directly (it's not axis-aligned), but you can save it's boundingRect:
Rect r = rrect.boundingRect();
Rect bounds(0,0,rgb.cols,rgb.rows);
Mat crop = rgb(r);
rgb(r & bounds); // make sure, we stay inside the image
imwrite(format("letters_%04d.png", idx), crop);