accessing pixels in an image - histograms help?

This is a discussion on accessing pixels in an image - histograms help? within the C++ Programming forums, part of the General Programming Boards category; hi everyone, I have a question regarding images. I was hoping to create a program that looks at the pixel ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    99

    accessing pixels in an image - histograms help?

    hi everyone, I have a question regarding images. I was hoping to create a program that looks at the pixel values in images sort of like a histogram. Anyway in my mind (im not a great programmer and this will probably be wrong I imagined it just being like reading a text file character by character only i would read an image pixel by pixel reading each ones value as i go along. Could it really be as simple as this? If anyone can point me in a starting direction i would much appreciate it or even websites i could possibly look at to research this?


    thanks

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    890
    Sure, you can read a binary file and look at the bytes if you know the image format. You can probably find an image processing library to help.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    > Could it really be as simple as this?
    For certain kinds of BMP files, yes it can be that simple.

    But for things like say PNG, you should use a library to get the pixels for you.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    For jpeg images, there are jpeg libraries available from various source.

    Windows is also capable of dealing with a fair number of image formats natively, such as BMP, JPEG, PNG - once you have loaded the image with LoadImage(), the pixels are available to you (using the relevant GDI functions).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading tiff image files?
    By compz in forum C++ Programming
    Replies: 9
    Last Post: 10-30-2009, 04:17 AM
  2. Accessing an image stored in an array.
    By Mr.Sellars in forum C++ Programming
    Replies: 1
    Last Post: 07-11-2008, 11:46 AM
  3. Image rotation - doesn't always work
    By ulillillia in forum C Programming
    Replies: 12
    Last Post: 05-03-2007, 12:46 PM
  4. Replies: 4
    Last Post: 03-02-2003, 08:12 AM
  5. creating image from pixels stored in file
    By Kristian25 in forum Windows Programming
    Replies: 3
    Last Post: 01-21-2003, 01:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21