How to read pixel values of a Bitmap Image.

Discussion in 'C++' started by ajay_itbhu, Jan 29, 2007.

  1. ajay_itbhu

    ajay_itbhu Guest

    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.
    ajay_itbhu, Jan 29, 2007
    #1
    1. Advertising

  2. ajay_itbhu wrote:
    > 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
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Jan 29, 2007
    #2
    1. Advertising

  3. ajay_itbhu

    BobR Guest

    ajay_itbhu wrote:
    > 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
    BobR, Jan 29, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?cGJ1bQ==?=

    GDI+ - limits for pixel dimensions in a bitmap object

    =?Utf-8?B?cGJ1bQ==?=, Jun 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    346
    =?Utf-8?B?cGJ1bQ==?=
    Jun 18, 2004
  2. Gandalf

    Masked bitmap from bitmap

    Gandalf, Jan 29, 2004, in forum: Python
    Replies:
    0
    Views:
    565
    Gandalf
    Jan 29, 2004
  3. Jason B

    Pixel Array => Bitmap File

    Jason B, Feb 27, 2007, in forum: Python
    Replies:
    3
    Views:
    696
    Jason B
    Feb 27, 2007
  4. xqggz
    Replies:
    1
    Views:
    405
    Victor Bazarov
    Jun 19, 2007
  5. André Wagner

    Fastest pixel by pixel operation

    André Wagner, Mar 17, 2008, in forum: Java
    Replies:
    12
    Views:
    1,025
    Larry A Barowski
    Mar 19, 2008
Loading...

Share This Page