0

I have some problem with image processing (24-color bmp and 8-bit grayscale).
I have read a *.bmp file.
Can anyone help to rotate and flip bitmap image(using C++, without openCV library)?
Thanks.

3
Contributors
2
Replies
18
Views
4 Years
Discussion Span
Last Post by DeanMSands3
0

Represent the image as a 2D array of pixels. Make a new blank 2D array of the same size.

Flipping:
For all width and all height, copy pixel[i, j] to newpixel[height-i, j] (remember to start counting at zero).

Rotation is a similar simple transformation. This is programming. The art, craft and sometimes science of thinking about a problem in a way that the solution lends itself to a programmatic soultion. All that other stuff is just learning the tool.

If you get stuck, do it on paper. Think about the image you're trying to create. For example, rotation; well, the new image will be as wide as the original was high, and as high as the original was wide. Now where does each pixel go?

Edited by Moschops

0

Define "read."
The question that should be asked is "do you know how to actually load and process the BMP?" You know that the BMP data is upside down compared to your screen, right? (I was going to say the BMP is upside down, but, no, it's screens that are.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.