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.

Recommended Answers

All 2 Replies

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?

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.)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.