Rotate the image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • krishnasamy
    New Member
    • Jun 2007
    • 31

    Rotate the image

    Hi,

    I have a Image data which retrieving from Camera device. Now that data has mirror position. Now I need to rotate that image data as usual position.

    Anybody knows that please give an example or reference website.

    Thank you
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Well, you could look for some sort of rotate function in a library, and use that, or you could write a function to move it yourself, as if you're rotating 180 degrees, you're taking the pixel in (1,1( and moving it to (max,max) - and conversely, (max,max) to (1,1)...

    So I'd pick one of those, and then try it - that's the best way to learn it.

    Comment

    • krishnasamy
      New Member
      • Jun 2007
      • 31

      #3
      Originally posted by sicarie
      Well, you could look for some sort of rotate function in a library, and use that, or you could write a function to move it yourself, as if you're rotating 180 degrees, you're taking the pixel in (1,1( and moving it to (max,max) - and conversely, (max,max) to (1,1)...

      So I'd pick one of those, and then try it - that's the best way to learn it.

      Thanks for your reply.

      Actually I am new person to the vc++. So I could not write the code for taking the pixel one by one.

      Can you have any simple example in c or c++ or vc++6.0? Please give.

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        Originally posted by krishnasamy
        Thanks for your reply.

        Actually I am new person to the vc++. So I could not write the code for taking the pixel one by one.
        You could, actually, and you would learn a lot doing it. The only thing keeping you from doing it is your attitude that you think you can't.
        Originally posted by krishnasamy
        Can you have any simple example in c or c++ or vc++6.0? Please give.
        Nope. Sorry. But if you Google search 'c++ graphics library' the more popular ones will have good documentation and you can figure out how to use them pretty easily.

        Comment

        • Studlyami
          Recognized Expert Contributor
          • Sep 2007
          • 464

          #5
          or search for rotating bitmap mfc (or replace mfc with vc++) and you will find several links within the top 10 that will have full code examples of how to do this. Do a little bit of research and try it out. If it doesn't work right post up where you are having a problem and your code that relates to the problem.

          Comment

          • krishnasamy
            New Member
            • Jun 2007
            • 31

            #6
            Originally posted by Studlyami
            or search for rotating bitmap mfc (or replace mfc with vc++) and you will find several links within the top 10 that will have full code examples of how to do this. Do a little bit of research and try it out. If it doesn't work right post up where you are having a problem and your code that relates to the problem.

            I have retrieved the image data from the camera device. Now I need to rotate that image data using gdi+. I have using following code for rotating the image.



            void RotFlipImg::Fli pImgData(char* mydata,prUInt32 imgsize)

            {

            FILE *fptr1;

            fptr1=fopen("li veimage.jpg","w b");

            fwrite(mydata,i mgsize,1,fptr1) ;

            fclose(fptr1);


            GdiplusStartupI nput gdiplusStartupI nput;

            ULONG_PTR gdiplusToken;

            GdiplusStartup( &gdiplusToke n, &gdiplusStartup Input, NULL);

            Bitmap* bitmap = new Bitmap(L"liveim age.jpg");

            bitmap->RotateFlip(Rot ateNoneFlipX);

            bitmap->Save(L"FlipIma ge.jpg",&guidBm p);

            delete bitmap;

            }



            In above code, I write that data into "liveimage. jpg" after rotate liveimage.jpg to FlipImage.jpg. It will becomes late. So I have to directly rotate the image data(mydata).



            How can I rotate the image as stream data without using direct image?.

            Comment

            Working...