Click here to Skip to main content
15,743,299 members
Please Sign up or sign in to vote.
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


1 solution

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?
...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
Share this answer
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?

...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)

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