Ask Your Question
0

Highlight the Squares in an Image using OpenCV for iOS

asked 2012-12-06 22:49:05 -0600

srinu ambati gravatar image

Hi all,

I have to highlight the squares in an Image Using the OpenCv . I am trying to implement this since 3 days , but not getting how to do this. Please help me to do this . Thanks in advance .

edit retag flag offensive close merge delete

Comments

I have seen that but not getting . If you have any samples please send me the links. Thanks in advance .

srinu ambati gravatar imagesrinu ambati ( 2012-12-07 01:28:49 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2012-12-07 00:35:45 -0600

AMP gravatar image

You can use "squares.cpp" in samples folder to implement that for iOS.(you need to edit this code)

edit flag offensive delete link more

Comments

Could you send me the link?

srinu ambati gravatar imagesrinu ambati ( 2012-12-07 01:16:00 -0600 )edit

It's in your OpenCV folder! ...../OpenCV-2.4.3/samples/cpp/squares.cpp

I can mail it to you if you want.

AMP gravatar imageAMP ( 2012-12-07 01:36:42 -0600 )edit

I got it I have squares.cpp file. But unable to integrate it in the Xcode Project. Please tell me. Thanks in advance .

srinu ambati gravatar imagesrinu ambati ( 2012-12-07 03:47:40 -0600 )edit

Sorry I don't know objectiveC programming and Xcode project...!

AMP gravatar imageAMP ( 2012-12-07 04:18:42 -0600 )edit

hmm thanks for your reply dude

srinu ambati gravatar imagesrinu ambati ( 2012-12-07 04:36:55 -0600 )edit
0

answered 2012-12-27 15:00:52 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Its pretty simple.

Just pass your gray scale image through findContours method. This method will return all the contours found in ur image.

Then iterate through the returned set of contours and apply approxPolyDP() for each set of contours in the set.

Check if the output size of the output from approxPolyDP is equal to 4.

If yes, then it means that it has found a square/rectangle in the given image.

Hope you got an idea.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-12-06 22:49:05 -0600

Seen: 1,891 times

Last updated: Dec 27 '12