Thread: Rotating a picture

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    1

    Rotating a picture

    Hello.

    I want to rotate a picture shown in an LCD.

    Let V1[N1][K1] be the vector that contains the pixels
    of the picture, what is the algorigthm that will give me
    the vector V2[N2][K2] that contains the rotated picture
    of the V1 ???

    Thanks.

  2. #2
    Registered User
    Join Date
    Apr 2004
    Posts
    58
    transpose?
    even a fish would not have been in danger had it kept its mouth shut.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Like this?
    Code:
    1 2 3
    4 5 6
    7 8 9
    
    7 4 1
    8 5 2
    9 6 3
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    First, you go to Wotsit and look up the file format you'll be using for the image.
    Next, you write something to read the file into memory.
    Then, you look up the portion of the file that stores dimensions, and rework that to store the transposed X and Y dimensions.
    Then you rework the portion of the data that contains the actual image to correspond to the new rotated data.
    Then you're done. Or close anyway.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If you want to rotate the bitmap to an arbitrary angle then google 'rotating bitmaps'.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [C] change picture width and height in Static control (no MFC)
    By pc2-brazil in forum Windows Programming
    Replies: 1
    Last Post: 05-05-2008, 01:17 AM
  2. Insert A Picture into C++
    By SweeLeen in forum C++ Programming
    Replies: 3
    Last Post: 03-07-2006, 05:52 AM
  3. Embedding Objects into Picture Controls
    By Capsher Codah in forum Windows Programming
    Replies: 1
    Last Post: 03-05-2005, 09:38 PM
  4. Insert picture for printing
    By ooosawaddee3 in forum C Programming
    Replies: 0
    Last Post: 04-05-2002, 09:26 PM
  5. How To Import A Bitmap Picture Correctly Using Visual C++ 6 ?
    By SonicWave in forum Windows Programming
    Replies: 2
    Last Post: 09-16-2001, 09:28 AM