如何处理JPG图片用C / C ++最容易? [英] How to process jpg images with c/c++ most easily?

查看:113
本文介绍了如何处理JPG图片用C / C ++最容易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要遍历在 JPG 格式图像的每个像素的颜色,

I want to iterate over each pixel color in a jpg format image,

哪个库我应该是指做到这一点,这样的code可以尽可能的短?

which library should I refer to to do this so that the code can be as short as possible?

推荐答案

我能想到的任何的ImageMagick的 CIMG 。这里是一个你CIMG教程。它们抽象掉了很多DECOM pression细节,只是给你一个网格的工作。

I can think of either ImageMagick or CImg. Here is a CImg tutorial for you. They abstract away a lot of the decompression details and just give you a grid to work with.

如果您CIMG去,你只需要使用数据通话。你也许可以这样做:

If you go with CImg, you only need to use the data call. You can probably do something like:

CImg<unsigned char> src("image.jpg");
int width = src.width();
int height = src.height();
unsigned char* ptr = src.data(10,10); // get pointer to pixel @ 10,10
unsigned char pixel = *ptr;

这篇关于如何处理JPG图片用C / C ++最容易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆