[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Image Rotation Correction

I am using the following to rotate an image:

RadianDegree = RotationDegree * (0.0174533)

NewX = CenterOfImage + (OriginalX - CenterOfImage) * Cosine(RadianDegree) - (OriginalY - CenterOfImage) * Sine(RadianDegree)
NewY = CenterOfImage + (OriginalX - CenterOfImage) * Sine(RadianDegree) + (OriginalY - CenterOfImage) * Cosine(RadianDegree)


Now, it works, but there are holes in the new image. I would like to somehow get rid of the holes, how would that be done?
0
List244
Asked:
List244
2 Solutions
 
bobsanders653Commented:
Beyond me as to the math equation.  I do know that IrfanView at:  http://www.irfanview.com/ can rotate an image quite well and is freeware.  
0
 
lherrouCommented:
What language and toolkit (if any) are you using?
0
 
List244Author Commented:
C++ for math, VB for setting points.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
lherrouCommented:
Your question might be better answered in the C++ TA. You can either post in the Community Support TA (click on Support in the upper right of each page, and post a question including the URL of this question, asking it be moved) or post a pointer question in the C++ TA (Go to the C++ TA, create a new question worth 20 points, title it "Pointer to C++ Image Rotation question" and include the URL of this question in the body).

Having said that, have you looked at either of the following as a way to avoid doing this yourself?
http://www.imagemagick.org/Magick++/
http://www.codeproject.com/bitmap/cximage.asp
0
 
List244Author Commented:
Actually this is a part of a bigger project, so the images I need rotated are not specific,
but random. So I can not use something else to rotate them.
0
 
lherrouCommented:
Yes, that's why I didn't suggest something like IrfanView, but rather the first link is a C++ API, and the other a C++ class.
0
 
List244Author Commented:
Sorry, the images on the sites through me off, I will take a look later
tonight.
0
 
ozoCommented:
You can rotate an image with with 3 axis parallel shear transforms
see Subject 3.01: How do I rotate a bitmap?
in http://www.faqs.org/faqs/graphics/algorithms-faq/
0
 
List244Author Commented:
A bit busy with school, I will go ahead and close the question and look over it all in a little.
I am sure those source files will be good soon as I can get a look at them, thanks everyone.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now