Ask Your Question
1

Can you detect rectangles with OpenCV 2.4.4?

asked 2013-03-15 18:26:28 -0600

MysticBE gravatar image

updated 2013-03-16 19:36:16 -0600

I've been wondering about this since I can't find any solid information about detecting rectangles with the OpenCV Library 2.4.4. Is this possible after a Canny edge detection to find the largest rectangle? I could only find some C code http://stackoverflow.com/questions/8667818/opencv-c-obj-c-detecting-a-sheet-of-paper-square-detection (the top answer of the 2).

Is there a way to do this with Java? Cause I can't get the C-code to work in the Java Native Interface part of the application (I find it kind of confusing). Does anyone have any good tutorials on writing the code from the JNI part (needs to be more then C-code i assume) or a Java/OpenCV Library implementation to do this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-03-16 08:43:07 -0600

Guanta gravatar image

What is your concrete problem? Maybe you want to post what you have so far and let us know what doesn't work or where you have problems.

The following links may also help you to detect rectangles: http://opencv-code.com/tutorials/automatic-perspective-correction-for-quadrilateral-objects/ and http://opencv-code.com/tutorials/detecting-simple-shapes-in-an-image/

edit flag offensive delete link more

Comments

Finding the C code isn't the problem (although a big thanks for that) but I can't seem to implement it in the JNI part of the Android project. Is there a tutorial on how to do that? Cause when i copy paste the code to my .cpp file in the JNI part everything seems to be an error (even the #include parts)

MysticBE gravatar imageMysticBE ( 2013-03-16 09:27:04 -0600 )edit
1

So I am not experienced in programming for Android, neither coding in Java. Basically, you need to transfer the code from C/C++ to Java. Or am I wrong? This shouldn't be too difficult. Replace the #includes to imports, e.g. import org.opencv.imgproc.Imgproc and then you can use any imageproc function, e.g. ImgProc.Canny(...) , the structure of the parameters should be the same, of course some data-types are different, e.g. Lists (or ArrayList?) vs std::vector. Some examples you'll find below samples/java and if you search here in the forum or via any search-machine. The java-api you'll find at http://docs.opencv.org/java/ . Good luck!

Guanta gravatar imageGuanta ( 2013-03-17 13:36:31 -0600 )edit

Question Tools

Stats

Asked: 2013-03-15 18:26:28 -0600

Seen: 18,462 times

Last updated: Mar 16 '13