How to read pixel values of a Bitmap Image.

A

ajay_itbhu

Hi everyone, I want to read the pixel values of 2 similar images in
bitmap format like 2 continuous frame of a video for calculating the
median. But i dont know how to read the pixel values of bitmap
image.so please help me in doing this in c++.
thank you.
 
V

Victor Bazarov

ajay_itbhu said:
Hi everyone, I want to read the pixel values of 2 similar images in
bitmap format like 2 continuous frame of a video for calculating the
median. But i dont know how to read the pixel values of bitmap
image.so please help me in doing this in c++.

"bitmap format", "video", "pixel values", are all undefined in C++.
You need to ask this in a newsgroup where "bitmap" is on topic, most
likely the newsgroup for your operating system.

Generally, reading a pixel in a pixmap involves opening a file,
reading its header, figuring out the layout of the file depending
on the format, then getting to the content part (image), reading the
(potentially encoded, packed) scan lines, then, using the offsets
calculated from the header information, extracting the color and/or
other information from the (decoded, unpacked) lines. All this
has nothing to do with the language itself.

V
 
B

BobR

ajay_itbhu said:
Hi everyone, I want to read the pixel values of 2 similar images in
bitmap format like 2 continuous frame of a video for calculating the
median. But i dont know how to read the pixel values of bitmap
image.so please help me in doing this in c++.
thank you.

// #include <iostream> <fstream> <vector>
{ // main or function
std::ifstream Ping("Some.png",
std::ios_base::in|std::ios_base::binary );
if( not Ping.is_open() ){
std::cout<<"\n ifstream FAILED"<<std::endl;
// return or exit(EXIT_FAILURE) here
}

std::vector<unsigned char> Image;

while( Ping.peek() != EOF ){
Image.push_back( Ping.get() );
} // while()

// use 'Image' here, or pass it somewhere.
} // main or function end

If you are asking about the bitmap format, you are in the wrong NG (it's
OT here). There are many libraries that handle the graphic formats, just
use your favorite searh engine to find them (Google).

I don't know if programmersheaven is still up, but, there was a ton of
links there for graphics.

Bob R
POVrookie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top