Now, many image processing tools and open source libraries give the function interface of image decoding, but sometimes these interfaces do not fully meet our needs, such as if we want to directly decode the JPEG data in memory, there is no such interface.
As a result of the previous project just good equipment transmitted image data is JPEG format, if the image data to save each frame to file and then use the interface provided by the open Source Library to read into the file will be very plunges, so do some direct decoding in-memory JPEG data research. After comparison found that the Libjpeg library to JPEG image codec support is very good, and compared to the OpenCV library, the complexity is much smaller, it is therefore decided to implement the interface I want to do.
The so-called "paddle", to use the Libjpeg library, the first step is naturally to download its source code, here.
after downloading the solution decompression, it is necessary to compile the Libjpeg library, here I mainly refer to this article and this article. Because the first article is VS2012, some paths are slightly different from this article, so if you are using VS2012, please do not hesitate to open the link, follow his steps to do it . Of course, it is to say, VS2013 is really good to use too much.
OK, now it's time to prepare for the compilation, in fact it's two steps:
The first step: Find the "jpeg-9a" folder just extracted from the "MAKEFILE.VC"file, open it with the editing tools such as Notepad or notepad++, and then find the"!include <win32.mak>", you will "Win32.mak"to an absolute path. It's not hard to see thisWin32.mak is a file thatis a file under VS, so the path is related to your own version of VS, I installed the VS2013 version, by default this file in "C:\Program files (x86) \microsoft Sdks\windows\v7.1a\ Include "under this directory. So we changed the words we just searched to"!include <C:\Program Files (x86) \microsoft Sdks\windows\v7.1a\include\win32.mak>" it's OK.
Step Two:Open the VS2013 command line:"vs2013 x86 native tool command Prompt " Span style= "COLOR: #3366ff", this opens with Start menu convenient point, directly find "Visual Studio 2013" This item, open inside " Span style= "Color:rgb (51,102,255); font-family:kaiti_gb2312; font-size:18px ">jpeg-9a " directory, enter "nmake/f makefile.vc setup-v10 " , enter, after the command line finishes executing the command, The preparation is done. For command-line operations, such as:
The following to do the compilation, in fact, there is no difficulty, the above work is done,"jpeg-9a"A vs project will be generated under the folder. Run directly inside the"Jpeg.sln", and then the VS hint to upgrade the compiler what the point is, go into the programming interface and compile directly and you're done. After compiling , you can see a "jpeg.lib" file in the "Release" folder under the "jpeg-9a" folder, which is the static link library we just compiled.
to use this static link library, simply include the firstJconfig.h,jmorecfg.h,jpeglib.hthese three header files, and then put the newly compiledJpeg.lib add in In the works. Habit will put jpeg.lib renamed to li b jpeg.lib
< Span style= "COLOR: #3366ff" > project
< Span style= "COLOR: #3366ff" > decoding in Memory jpeg data will be followed by a detailed description of the article, Once completed, the link is placed.
< Span style= "COLOR: #3366ff" > decoding in-memory jpeg Data implementation method article address
VS2013 Compiling the Libjpeg library