Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get x,y coordinates of extracted objects in javacv?
    primarykey
    data
    text
    <p>Currently I am developing image processing project and I'm using javacv to develop image processing components. I was able to extract some interesting parts of a image and now I need to read the x and y coordinates of those objects. This is the image that I haveextracted</p> <p><img src="https://i.stack.imgur.com/Q7i84.png" alt="enter image description here"></p> <p>And I need to identify those objects and draw square around those objects. I went through some tutorials and try to identify objects using following code.</p> <pre><code> IplImage img="sourceimage"; CvSize sz = cvSize(img.width(), img.height()); IplImage gry=cvCreateImage(sz, img.depth(), 1); cvCvtColor(img, gry, CV_BGR2GRAY); cvThreshold(gry, gry, 200, 250, CV_THRESH_BINARY); CvMemStorage mem = CvMemStorage.create(); CvSeq contours = new CvSeq(); CvSeq ptr = new CvSeq(); cvFindContours(gry, mem, contours, Loader.sizeof(CvContour.class) , CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0)); CvRect boundbox; for (ptr = contours; ptr != null; ptr = ptr.h_next()) { boundbox = cvBoundingRect(ptr, 0); if(boundbox.height()&gt;10||boundbox.height()&gt;10){ cvRectangle( gry, cvPoint( boundbox.x(), boundbox.y() ), cvPoint( boundbox.x() + boundbox.width(), boundbox.y() + boundbox.height()),CvScalar.BLUE, 0, 0, 0 ); System.out.println(boundbox.x()+", "+boundbox.y()); } } cvShowImage("contures", gry); cvWaitKey(0); </code></pre> <p>But it doesn't draw as rectangle around the objects. I would like to know whether I can use cvFindContours method to identify those objects ? Please can some one explain how to archive my objective using javacv/opencv?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload