I try to use the well known "jpeglib" now available in version 9.
Overview: I am a programming starter in C using MS Visual C++ 2010 Express and read a C-book finally. My goal is to compress a RGB(.bmp)-file into JPEG. So I downloaded the jpeglib (v9), read all the install and so on *.txt-files. It was possible to compile the C-files to get cjpeg.exe, djpeg.exe, jpeg.lib and so on.
After this success I tried to use the example.c to get deeper into the jpeg and to control the compression. -> It did not work. Then I tried to use the jpeglib included in OpenCV. Same non working result, while the OpenCV code samples are compiled successfully.
I googled lots of samples, problem solutions and tips how to use jpeglib. Most helpful information I found here. But in the result I was still not able to compile my own jpeg-tool or example.c (rewriting the write_JPEG_file()
function ).
Question: What in the basics could be wrong, when every other programmer just uses #include "jpeglib.h"
in their codes to run the jpeg functions successfully? For me including this file seems not to be enough. Because of that I have to ask you and to relaunch a one year old Question that also did not helped solving my probs. I can not give you a specific error message because of multiple attempts to solve those issues.
Here is my current MS-VC++2010 config for using OpenCV 2.4.6:
At last some threads I have already read:
If there is something missing you want to know I will do my best to add this information!
EDIT - Some error messages:
1>jpeg_coder.obj : error LNK2001: unresolved external symbol ""unsigned char * image_buffer" (?image_buffer@@3PAEA)".
1>jpeg_coder.obj : error LNK2001: unresolved external symbol ""int image_height" (?image_height@@3HA)".
1>jpeg_coder.obj : error LNK2001: unresolved external symbol """int image_width" (?image_width@@3HA)".
First symbol should be typedefed in jpeglib.h
as JSAMPLE FAR *JSAMPROW
,
second and third are defined in rdjpgcom.c
as unsigned int image_height, image_width;
Maybe, with a lot of luck, I figured out what is need to be done to get jpeglib running. In the current state I have to check and double check whether my problem solution is correct or not. At this point thank you very much for your attention for my issues. As soon as I am sure with the solution I will post it.
Problem Solution: I did not setup OpenCV correctly for using jpeglib. The mistake I made was to link the wrong *.lib-file. The proper file for linking is libjpegd.lib
. Too bad that jpeglib v6.2 is included in OpenCV 2.4.6 instead of v9. The hint to add HAVE_JPEG
to use jpeglib functions inside OpenCV I ignored completely. For now the problem is solved.
Problem Solution: I did not setup OpenCV correctly for using jpeglib. The mistake I made was to link the wrong *.lib-file.
The proper file for linking is libjpegd.lib
.
Too bad that jpeglib v6.2 is included in OpenCV 2.4.6 instead of v9. The hint to add HAVE_JPEG
to use jpeglib functions inside OpenCV I ignored completely. Thanks to all who tried solving this issue. For now the problem is solved.