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

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

问题描述

我想在 jpg 格式图片中迭代每个像素颜色,

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

推荐答案

我可以想到 ImageMagick CImg 。以下是您的 CImg教程。他们抽象了很多的解压缩细节,只是给你一个网格工作。

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,你只需要使用 data call。您可以执行类似以下操作:

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;

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

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