hello,
i want to find rectangle from below image
C:\fakepath\sample3_blue_answers-compressor (1).png
how to find those four border rectangle from this image?
Thanks in advance
1 | initial version |
hello,
i want to find rectangle from below image
C:\fakepath\sample3_blue_answers-compressor (1).png
how to find those four border rectangle from this image?
Thanks in advance
2 | No.2 Revision |
hello,
i want to find rectangle from below image
C:\fakepath\sample3_blue_answers-compressor (1).png
how to find those four border rectangle from this image?
Thanks in advance
3 | No.3 Revision |
hello,
i want to find rectangle from below image
how to find those four border rectangle from this image?
Thanks in advance
4 | No.4 Revision |
hello,
i want to find rectangle from below image
how to find those four border rectangle from this image?
Thanks in advance
5 | No.5 Revision |
hello,
i want to find rectangle from below image
how to find those four border rectangle from this image?
i have tried with this code
Mat rgbMat=ImageUtils.bitmapToMat(resultBitmap);
Mat grayMat = new Mat(resultBitmap.getHeight(), resultBitmap.getWidth(),CvType.CV_8U, new Scalar(1));
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 2);
Imgproc.threshold(grayMat, grayMat, 100, 255, Imgproc.THRESH_BINARY);
Core.bitwise_not(grayMat, grayMat);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(grayMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
List<Point> pointList=new ArrayList<Point>();
for(int i=0; i<contours.size(); i++)
{
Rect rect = Imgproc.boundingRect(contours.get(i));
double k = (rect.height+0.0)/rect.width;
if (0.9<k && k<1.1 && rect.area() > 100)
{
Imgproc.drawContours(rgbMat, contours, i, new Scalar(255, 0, 0), 3);
}
}
resultBitmap = ImageUtils.matToBitmap(rgbMat);
Thanks in advance
6 | No.6 Revision |
hello,
i want to find four black cornered rectangle from below image
how to find those four border rectangle from this image?
i have tried with this code
Mat rgbMat=ImageUtils.bitmapToMat(resultBitmap);
Mat grayMat = new Mat(resultBitmap.getHeight(), resultBitmap.getWidth(),CvType.CV_8U, new Scalar(1));
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 2);
Imgproc.threshold(grayMat, grayMat, 100, 255, Imgproc.THRESH_BINARY);
Core.bitwise_not(grayMat, grayMat);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(grayMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
List<Point> pointList=new ArrayList<Point>();
for(int i=0; i<contours.size(); i++)
{
Rect rect = Imgproc.boundingRect(contours.get(i));
double k = (rect.height+0.0)/rect.width;
if (0.9<k && k<1.1 && rect.area() > 100)
{
Imgproc.drawContours(rgbMat, contours, i, new Scalar(255, 0, 0), 3);
}
}
resultBitmap = ImageUtils.matToBitmap(rgbMat);
Thanks in advance
7 | No.7 Revision |
hello,
i want to find four black cornered rectangle from below image
how to find those four border rectangle from this image?
i have tried with this code
Mat rgbMat=ImageUtils.bitmapToMat(resultBitmap);
Mat grayMat = new Mat(resultBitmap.getHeight(), resultBitmap.getWidth(),CvType.CV_8U, new Scalar(1));
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 2);
Imgproc.threshold(grayMat, grayMat, 100, 255, Imgproc.THRESH_BINARY);
Core.bitwise_not(grayMat, grayMat);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(grayMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
List<Point> pointList=new ArrayList<Point>();
for(int i=0; i<contours.size(); i++)
{
Rect rect = Imgproc.boundingRect(contours.get(i));
double k = (rect.height+0.0)/rect.width;
if (0.9<k && k<1.1 && rect.area() > 100)
{
Imgproc.drawContours(rgbMat, contours, i, new Scalar(255, 0, 0), 3);
}
}
resultBitmap = ImageUtils.matToBitmap(rgbMat);
Please help me ..
Thanks in advance
8 | No.8 Revision |
hello,
i want to find four black cornered rectangle from below image
how to find those four border rectangle from this image?
i have tried with this code
Mat rgbMat=ImageUtils.bitmapToMat(resultBitmap);
Mat rgbMat=ImageUtils.bitmapToMat(resultBitmap);
Mat grayMat = new Mat(resultBitmap.getHeight(), resultBitmap.getWidth(),CvType.CV_8U, new Scalar(1));
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 2);
Imgproc.threshold(grayMat, grayMat, 100, 255, Imgproc.THRESH_BINARY);
Core.bitwise_not(grayMat, grayMat);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(grayMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
List<Point> pointList=new ArrayList<Point>();
for(int i=0; i<contours.size(); i++)
{
Rect rect = Imgproc.boundingRect(contours.get(i));
double k = (rect.height+0.0)/rect.width;
if (0.9<k && k<1.1 && rect.area() > 100)
{
Imgproc.drawContours(rgbMat, contours, i, new Scalar(255, 0, 0), 3);
}
}
resultBitmap = ImageUtils.matToBitmap(rgbMat);
Please help me ..
Thanks in advance
9 | No.9 Revision |
hello,
i want to find four black cornered rectangle from below image
how to find those four border rectangle from this image?
i have tried with this code
Mat rgbMat=ImageUtils.bitmapToMat(resultBitmap);
Mat grayMat = new Mat(resultBitmap.getHeight(), resultBitmap.getWidth(),CvType.CV_8U, new Scalar(1));
Imgproc.cvtColor(rgbMat, grayMat, Imgproc.COLOR_RGB2GRAY, 2);
Imgproc.threshold(grayMat, grayMat, 100, 255, Imgproc.THRESH_BINARY);
Core.bitwise_not(grayMat, grayMat);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat hierarchy = new Mat();
Imgproc.findContours(grayMat, contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
List<Point> pointList=new ArrayList<Point>();
for(int i=0; i<contours.size(); i++)
{
Rect rect = Imgproc.boundingRect(contours.get(i));
double k = (rect.height+0.0)/rect.width;
if (0.9<k && k<1.1 && rect.area() > 100)
{
Imgproc.drawContours(rgbMat, contours, i, new Scalar(255, 0, 0), 3);
}
}
resultBitmap = ImageUtils.matToBitmap(rgbMat);
Please help me ..
Thanks in advance