Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Using JavaCV to detect Rectangles (http://www.chiefdelphi.com/forums/showthread.php?t=111494)

Rainfur 17-01-2013 20:14

Using JavaCV to detect Rectangles
 
I'm currently using JavaCV to detect rectangles. However, I cannot get CvArr to work, and because of this, I cannot get cvConvexHull to work.

Is there any source for something like this? Could I get some assistance?

Ginto8 18-01-2013 00:39

Re: Using JavaCV to detect Rectangles
 
OpenCV refers to CvArr as "metatype", "used only as a function parameter". JavaCV implements this by making CvArr the superclass of the types it stands in for, like IplImage and CvSeq. It's not really supposed to be used on its own. What issues are you having exactly?

http://opencv.willowgarage.com/documentation/index.html is a must-have site for OpenCV programming if you're looking for reference material.

Rainfur 18-01-2013 00:49

Re: Using JavaCV to detect Rectangles
 
I'm specifically having problems with detecting corners and drawing lines between them.

I have it threshholded right now, however any and all methods I try to use to detect the corners have yet to work.

Ginto8 18-01-2013 19:00

Re: Using JavaCV to detect Rectangles
 
What methods are you using? What are they doing instead of working? I don't think I can help you properly without more information.

divixsoft 22-01-2013 15:58

Re: Using JavaCV to detect Rectangles
 
I have that problem as well, when I try this code, it compiles but when I use it I get errors.
Code:

    public static WPIContour[] findConvexContours(WPIBinaryImage image)
    {
        image.validateDisposed();

        IplImage tempImage = IplImage.create(image.image.cvSize(), image.image.depth(), 1);

        opencv_core.cvCopy(image.image, tempImage);

        CvSeq contours = new CvSeq();
        opencv_imgproc.cvFindContours(tempImage, storage, contours, 256, opencv_imgproc.CV_RETR_LIST, opencv_imgproc.CV_CHAIN_APPROX_TC89_KCOS);
        ArrayList<WPIContour> results = new ArrayList();
        while (!WPIDisposable.isNull(contours)) {
            CvSeq convexContour = opencv_imgproc.cvConvexHull2(contours, storage, opencv_imgproc.CV_CLOCKWISE, 1);
            WPIContour contour = new WPIContour(opencv_core.cvCloneSeq(convexContour, storage));
            results.add(contour);
            contours = contours.h_next();
           
           
        }

        tempImage.release();
        WPIContour[] array = new WPIContour[results.size()];
        return results.toArray(array);
    }



All times are GMT -5. The time now is 09:51.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi