How to rotate an image by 180 degree clockwise and counterclockwise using C codes?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rohit Ramesh
    New Member
    • Mar 2010
    • 5

    How to rotate an image by 180 degree clockwise and counterclockwise using C codes?

    I need help in C program in order to rotate any image clockwise and anticlockwise.

    I searched a lot on net but couldn't able to find any solution.
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    Does cw and ccw rotation differ in case of 180 degrees? Anyway, after you read the image from file and stored it in the array of pixels, swap appropriate pixels values for the whole array.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      What is the format of the image?

      Comment

      • Rohit Ramesh
        New Member
        • Mar 2010
        • 5

        #4
        image is in jpeg and size is 160*120. Please suggest me algorithm so that i can build some codes.. In image processing i am very new.

        Comment

        • jkmyoung
          Recognized Expert Top Contributor
          • Mar 2006
          • 2057

          #5
          As an opening, slow method, I suggest you first

          Convert the jpg into a 160x120 set of pixels.
          Rotate them accordingly, eg (i,j) -> (160-i, 120-j).
          Convert the pixels, back into a jpg.

          Once you've done this, you should be able to see a refinement in your method.

          Comment

          Working...