1 | initial version |
How to crop all the rectangles as bitmap and store those ?
you can use submat() like this:
if ((rect.height > 30 && rect.height < 120) && (rect.width > 120 && rect.width < 500))
{
Rect rec = new Rect(rect.x, rect.y, rect.width, rect.height);
Mat roi = imageMat.submat(rec);
String filename = ???
Imgcodecs.imwrite(filename, roi);
}
2 | No.2 Revision |
How to crop all the rectangles as bitmap and store those ?
you can use submat() like this:
if ((rect.height > 30 && rect.height < 120) && (rect.width > 120 && rect.width < 500))
{
Rect rec = new Rect(rect.x, rect.y, rect.width, rect.height);
Mat roi = imageMat.submat(rec);
String filename = Environment.getExternalStorageDirectory() + ???
Imgcodecs.imwrite(filename, roi);
}
3 | No.3 Revision |
How to crop all the rectangles as bitmap and store those ?
you can use submat() like this:
if ((rect.height > 30 && rect.height < 120) && (rect.width > 120 && rect.width < 500))
{
Rect rec = new Rect(rect.x, rect.y, rect.width, rect.height);
Mat roi = imageMat.submat(rec);
String filename = Environment.getExternalStorageDirectory() + ???
??? + ".png";
Imgcodecs.imwrite(filename, roi);
roi); // no need for bitmap conversion here.
}