使用libjpeg8d构建MATLAB jpeg工具箱 [英] building MATLAB jpeg toolbox with libjpeg8d

查看:138
本文介绍了使用libjpeg8d构建MATLAB jpeg工具箱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题与我在这里问到的另一个问题有关.

在Matlab的jpeg工具箱中使用jpeg_read读取图像时出错

我一直在尝试在Windows 7下编译jpeg工具箱(使用对我发布的问题的答案中提供的命令Shai提供的命令),但是出现以下错误:

jpeg_read.c(52) : fatal error C1083: Cannot open include file: 'jerror.h': No such file or directory 

我相信发生的

是因为我还没有构建libjpeg.我曾尝试像jpegtoolbox的README一样构建libjpeg6b,但是我找不到关于如何在Windows上使用Visual Studio 2010进行操作的明确指南(而且libjpeg的安装文档没有多大帮助),所以我结束了liblibeg8d的构建. >

我的问题是,是否可以使用libjpeg8d编译jpeg工具箱.我尝试运行命令:

mex -I<IJGPATH> jpeg_read.c <LIBJPEG>

在IJGPATH/Release中,IJGPATH是我的libjpeg8d安装文件夹,而LIBJPEG是jpeg.lib文件的路径,但是我仍然遇到和以前一样的丢失jerror.h错误.

谢谢.

解决方案

Jpeg工具箱包含用于处理JPEG文件的Matlab例程. Matlab的内置IMREAD和IMWRITE函数提供了JPEG文件和图像阵列之间的基本转换,但它们不提供对JPEG图像细节的访问,例如JPEG系数或量化表.

此程序包中的例程提供了直接从Matlab直接访问JPEG文件内容的其他功能,包括离散余弦变换(DCT)系数,量化表,霍夫曼编码表,色彩空间信息和注释标记.可以将工具箱添加到Matlab中以使用这些功能.

首先检查系统中是否安装了以下软件.

1.Microsoft Windows SDK 7 2.Microsoft Visual C ++ 2010 Express

如果未安装它们,请按照指定的顺序下载并安装它们.

注意:在安装Windows sdk之前,请卸载Visual c ++ 2010的所有redistributalbe软件包.其他Windows sdk在安装过程中会产生问题,并且安装失败.在安装过程中,请不要忘记在Windows Headers和Libraries下检查64位操作系统的"x64库"和32位操作系统的"x86库".这允许将编译器工具用于64位操作系统.一旦结束,请安装Visual c ++.这些工具是免费的,可以在Microsoft网站上获得.联机和脱机安装程序均可用. 现在是真正的集成过程

第1步:下载jpeg工具箱并将其解压缩到单独的文件夹(例如jpeg)

下载jpeg工具箱

第2步:下载jpeg源文件并将其解压缩到单独的文件夹(例如jpegsrc).在jpegsrc中的jpeg-6b文件夹中,将jconfig.vc重命名为jconfig.h,将makefile.vc重命名为makefile

下载jpegsrc文件

第3步:从开始->所有程序-> Microsoft Windows sdk,打开命令提示符.这将打开"Windows x64调试环境".导航到在步骤2提取的jpegsrc文件夹内的jpeg-6b文件夹.运行命令'nmake clean all',不带引号.这将在同一文件夹中创建libjpeg.lib文件.

第4步:现在打开matlab并选择在第1步中创建的工作文件夹jpeg.

现在在命令窗口中运行以下命令, 混合-I jpeg_read.c mex -I jpeg_write.c

替换为在步骤2中创建的IJG jpeg-6b目录的路径,然后 带有IJG代码库文件(libjpeg.lib)的完整路径.

要使用jpeg_read和jpeg_write函数,请将上面创建的jpeg_read.mexw64和jpeg_write.mexw64文件复制到您的工作目录中.不要卸载Visual c ++编译器,否则将无法正常工作.

This question is related to another question I asked here:

Error reading image using jpeg_read from Matlab's jpeg toolbox

I've been trying to compile the jpeg toolbox under Windows 7 (using the commands Shai provided in the answer to the question I posted), but I get the following error:

jpeg_read.c(52) : fatal error C1083: Cannot open include file: 'jerror.h': No such file or directory 

which I believe happened because I haven't built libjpeg. I tried to build libjpeg6b like jpegtoolbox's README says, but I couldn't find a clear guide on how to do it on Windows with visual studio 2010 (and libjpeg's install document doesn't help much), so I ended building libjpeg8d.

My question is if there's any way to use libjpeg8d to compile the jpeg toolbox. I've tried running the command:

mex -I<IJGPATH> jpeg_read.c <LIBJPEG>

with IJGPATH being my libjpeg8d installation folder and LIBJPEG being the path to the jpeg.lib file, inside IJGPATH/Release, but I still get the same missing jerror.h error as before.

Thanks in advance.

解决方案

Jpeg toolbox contains Matlab routines for manipulating JPEG files. While Matlab's built-in IMREAD and IMWRITE functions provide basic conversion between JPEG files and image arrays, they do not provide access to the details of the JPEG image, such as the JPEG coefficients or the quantization tables.

The routines in this package provide additional functionality for directly accessing the contents of JPEG files from Matlab, including the Discrete Cosine Transform (DCT) coefficients, quantization tables, Huffman coding tables, color space information, and comment markers. The toolbox can be added to Matlab to use the functions.

First check whether the following are installed in your system.

1.Microsoft windows sdk7 2.Microsoft visual c++ 2010 express

if they are not installed, Download and install them in the order specified.

Note: Before installing windows sdk, uninstall any redistributalbe packages of visual c++ 2010. Else windows sdk produces problem during installation and the install fails. During installation dont forget to check the 'x64 Libraries' for 64bit OS and 'x86 Libraries' for 32bit OS, under Windows Headers and Libraries. This allows to use compiler tools for 64 bit operating systems. Once it overs, install visual c++. These tools are free and available at microsoft website. Both online and offline installers are available. Now comes the real integration process

Step 1: Download the jpeg toolbox and extract it to a separate folder (eg. jpeg)

Download jpeg toolbox

Step 2: Download jpeg source files and extract it to a separate folder (eg.jpegsrc). In the folder jpeg-6b which is in jpegsrc, rename jconfig.vc to jconfig.h and makefile.vc to makefile

Download jpegsrc file

Step 3: From start->All programs-> Microsoft windows sdk , open the command prompt. This opens the 'windows x64 debug environment'. Navigate to the jpeg-6b folder which is inside the jpegsrc folder which is extracted at step 2. Run the command 'nmake clean all' without quotes. This creates the libjpeg.lib file in the same folder.

Step 4: Now open the matlab and choose the workfolder as jpeg, created in step 1.

Now in the command windows run the following commands, mex -I jpeg_read.c mex -I jpeg_write.c

Replace with the path to the IJG jpeg-6b directory created in step 2, and with the full path to the IJG code library file (libjpeg.lib).

To use the jpeg_read and jpeg_write functions copy jpeg_read.mexw64 and jpeg_write.mexw64 files created above to your work directory. Dont uninstall visual c++ compiler or it wont work.

这篇关于使用libjpeg8d构建MATLAB jpeg工具箱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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