如何使用C读取8位灰度JPEG图像? [英] How to read a 8-bit grayscale JPEG image using C?

查看:186
本文介绍了如何使用C读取8位灰度JPEG图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有谁能告诉我使用C读取8位

灰度JPEG图像的最简单代码是什么?


非常感谢,

速度

解决方案

Speed写道:





有人能告诉我什么是最简单的代码来读取8位

灰度JPEG图像使用C.



好​​吧,简单的答案就是用
二进制模式中的fopen()打开文件,并用fread()读取数据。


但是,这不太可能是你要问的。如果您要求

C是否具有图像处理功能,那么答案是否定的。

您必须找到一个带有C API的库那。你打算使用的平台很重要。


我推荐谷歌搜索,或者在专用图片的新闻组上询问

处理。


Brian


Speed写道,2007年7月18日23:06:





有人能告诉我什么是读取8位最简单的代码

灰度JPEG图像使用C.



FILE * jpeghandle = fopen(jpegname," rb");

if(jpeghandle)

while(getc(jpeghandle)!= EOF);


如果给出合适的定义和初始化,上面的内容将有效

of有关CHAR_BIT == 8的系统上的jpegname。


如果你想做更多的事情,那么说出你想要的东西可能是有用的。

要做。最可能有用的答案是你需要一个适当的

库来处理jpegs,它不仅仅是读取它。什么

库可用取决于你的实现,因此一个

的问题,其中包含与你的

实现相关的组的更多信息可能会帮助你更多。

-

Flash Gordon


速度< lo ****** **** @ gmail.com编写:





谁能告诉我什么是最简单的代码阅读使用C的8位

灰度JPEG图像。

非常感谢,

速度


你可能会得到大约30条回复,告诉你JPEG没有任何东西

与C有关 - 它们是对的。


但是,你可以通过查看英特尔开发的openCV

库来学到很多东西。


这里有一些文档的链接,详细介绍了cvLoadImage

http://vision.cis.udel.edu/opencv/re...ef_highgui.htm


无需重新发明轮子。

Hi,

Could anyone tell me what is the simplest code to read a 8-bit
grayscale JPEG image using C.

Thanks a ton,
Speed

解决方案

Speed wrote:

Hi,

Could anyone tell me what is the simplest code to read a 8-bit
grayscale JPEG image using C.

Well, the simple answer is that you open the file with fopen() in
binary mode, and read the data with fread().

However, that''s not likely what you are asking. If you''re asking
whether C has facilities for image handling, then the answer is no.
You''ll have to find a library with a C API for that. the platform you
intend to use will be important.

I recommend a Google search, or ask on a newsgroup dedicated to image
processing.


Brian


Speed wrote, On 18/07/07 23:06:

Hi,

Could anyone tell me what is the simplest code to read a 8-bit
grayscale JPEG image using C.

FILE *jpeghandle = fopen(jpegname,"rb");
if (jpeghandle)
while (getc(jpeghandle)!=EOF);

The above will work given an appropriate definition and initialisation
of jpegname on systems with CHAR_BIT==8.

If you want to do more it might be useful for you to say what you want
to do. The most probable useful answer is that you want an appropriate
library for handling jpegs that does rather more than just read it. What
libraries are available will depend on your implementation, and thus a
question with rather more information on a group related to your
implementation would probably help you more.
--
Flash Gordon


Speed <lo**********@gmail.comwrites:

Hi,

Could anyone tell me what is the simplest code to read a 8-bit
grayscale JPEG image using C.

Thanks a ton,
Speed

You will probably get about 30 replies telling you that JPEG has nothing
to do with C - and they will be right.

However, you can learn a lot by looking up the Intel developed openCV
libraries.

Here''s a link to some docs which details cvLoadImage

http://vision.cis.udel.edu/opencv/re...ef_highgui.htm

No need to reinvent the wheel.


这篇关于如何使用C读取8位灰度JPEG图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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