开发者

c++ read image pixels

开发者 https://www.devze.com 2022-12-28 19:14 出处:网络
I want a c+开发者_JAVA百科+ Code to read every pixel from an image file. and i want to save the pixels like:

I want a c+开发者_JAVA百科+ Code to read every pixel from an image file. and i want to save the pixels like: r[] g[] b[]

does somebody know how to do this?


The answer depends on the format of the image file. Is it a format which contains raw RGB data (such as uncompressed TGA)? Is it a YUV image? Is it a compressed image such as JPEG or PNG?

There are already plenty of C++ libraries out there which can read a wide variety of image file formats, and then provide the pixel-level access you require. Take a look at Adobe's GIL, or CImg for example.


There are many freely available libraries for reading different image file formats. Since you're using C++ you might want to look at Adobe's Generic Image Library (GIL) or even OpenCV.


This will sort you out, very easy to use and 'low level' image library: http://easybmp.sourceforge.net/


Two libraries that I've used that jump to mind are:

  • ImageMagick
  • libGD

These libraries can handle a wide variety of image formats, depending on what you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消