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