15,743,299 members
4.00/5 (1 vote)
See more:
Hi guys

I have a little project in opencv, just distinguishing coins from pens from a static image. All it does is basically find the contours of each object and draws a best fit elipse around it.

The coins are fine, problem I have is each elipse which is supposed to surround each pen is centered and the correct size but sits at a 90 degree angle to the object. Ive used the cvelipsebox function and I was wondering if there was a function to rotate this elipse 90 degrees? I've been googing but an't find a solution...If my code would make it easier, just let me know what you need to see

Any help would really be appriciated

Martyn
Posted

## Solution 1

not sure what this opencv is but if you are drawing an ellipse by specying X, Y, width and height then switch the width and hight values would produce a 90 degree rotation.

Sorry if I am off the mark with this one

EDIT: (Not quite sure how to work this Q&A stuff yet)

These functions? http://opencv.willowgarage.com/documentation/cpp/drawing_functions.html
...the first overload for ellipse function takes an angle value as the forth parameter. This could be set as -90 or 90 to give the correct rotation you would need. As you can see from the diagram in the link, the ellipse initially starts pointing to the right (90 degrees) so I would assume your drawing is defaulting to an angle of 0

v2
Comments
Smithers-Jones 1-Mar-11 9:53am
Answer of OP:
"nah its a c++ computer vision libary with different c++ functions & libarys

cheers though"
musefan 1-Mar-11 10:10am
These functions? http://opencv.willowgarage.com/documentation/cpp/drawing_functions.html

...the first overload for ellipse function takes an angle value as the forth param
kutalinelucas 1-Mar-11 10:40am
Thanks for looking that up...basically I have drawn a elipse around tracked objects so i'm using the cvelipseBOX function which doesn't take rotation as an argument. I think I may be able to rotate the image stored in cvbox2d and import that...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Graeme_Grant 90 OriginalGriff 60 merano99 40 Dave Kreskowiak 20 Richard MacCutchan 10
 OriginalGriff 1,698 Richard MacCutchan 1,328 merano99 609 Rick York 455 Dave Kreskowiak 296

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900