Ask Your Question

Zain ul abdeen's profile - activity

2019-09-03 10:19:25 -0600 received badge  Famous Question (source)
2017-06-29 01:23:36 -0600 received badge  Notable Question (source)
2017-01-13 07:11:52 -0600 received badge  Popular Question (source)
2016-01-16 18:53:47 -0600 received badge  Student (source)
2015-05-03 11:46:06 -0600 asked a question Create an array of Rectangles : Opencv , Android

I have contours which are extracted from findcontours() , Now I want to create an array of all the boundingrects of contours.

int area,total=0;

for(int i=0; i<contours.size(); i++)
{
area = (int) Imgproc.contourArea(contours.get(i));

if(area>4600 && area<5100)
{
    Rect abc = Imgproc.boundingRect(contours.get(i));                          
}
}

Here it is saving only 1 contour in Rect , I want an array of Rect of all contours.

2015-04-25 02:47:28 -0600 received badge  Enthusiast
2015-04-22 16:13:43 -0600 received badge  Editor (source)
2015-04-22 16:12:56 -0600 asked a question Sort contours top to bottom : Android

I have found the contour but the problem is that the findcontours() returns contours in random order like at contour(0) it shows some sontour from middle of the page. How can I sort them vertically? From top to bottom and then left to right? Given the image below I connected the components horizontally and connected every MCQ with their choices and then applied findcontours() and Now I want to sort them in an order that they should be retrieved sequentially.

EDIT: Sorry image is not uploading here

2015-04-20 14:06:19 -0600 commented question Find the number of white pixels in contour

Getting the boundingrect() and then counting non zero helped :)

2015-04-18 08:14:50 -0600 commented answer Find the number of white pixels in contour

I dont want area. I want pixels inside the contour

2015-04-18 06:17:08 -0600 asked a question Find the number of white pixels in contour

I have an image and I'm trying to find the filled circles inside image (MCQ's).

image description

I have found all contours and when drawing its drawing the circles but now I don't know how to find the number of white pixels inside contour. Image is in binary pealse suggest something. Thanks

java.util.List<MatOfPoint> contours_crop = new ArrayList<MatOfPoint>();
Imgproc.findContours(crop.clone(), contours_crop, new Mat() ,Imgproc.RETR_EXTERNAL , Imgproc.CHAIN_APPROX_SIMPLE);

//Imgproc.cvtColor(crop, crop, Imgproc.COLOR_GRAY2BGR);
double noPixels = Core.countNonZero(contours_crop.get(3));
Toast.makeText(MainActivity.this, "Pixels:"+noPixels, 10000).show();
2014-11-18 04:39:49 -0600 asked a question Load and display image in greyscale #Android #Java

Hi I'm very new to OpenCv and using OpenCv 2.4.9 in android and after spending lots of time I did'nt find anything in documentation. I want to load an image from sdcard and display it as grey scale image in android. Any help is appreciated