Hi,
I'm not sure what I'm doing wrong, but when I compile any new program that loads a image in the folder examples of dlib, I get the following error:
exception thrown: DLIB_JPEG_SUPPORT not #defined: Unable to load image in file test10.jpg
I get a similar error when I load a png image, with DLIB_PNG_SUPPORT
The command I used is the following:
g++ -O3 -I.. -lpthread -lX11 -lpng -ljpeg -lz img2edge.cpp -o img2edge
What is wrong? I'm sure that I have the libs png and jpeg loaded.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
folllowing solution WORKED PERFECTLY for visual studio with dlib:
1. add all the source files inside the dlib/externel/jpeg folder to the project
2. include the path of "C:/ dlib/external/jpeg ", to ur additional include directories and additional library directories in general, and linker respectively.
3. add "DLIB_JPEG_SUPPORT" to C/C++ -> preprocessor-> preprocessor definitions
4. compile and run the program. it works!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now it worked, thanks for the quick reply! I need to read better the documentation, but would be nice if each section of a group of functions specify the needed libs to link. I'm sorry if they are already in the documentation.
For anyone using QtCreator, in the .pro file, the following will work:
INCLUDEPATH += /home/user/libs/dlib-18.8
LIBS += -L/home/user/libs/dlib-18.8
LIBS += -pthread
LIBS += -lpng -ljpeg
CONFIG += link_pkgconfig
PKGCONFIG += x11
QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT
Anyway, the lib is very useful, good job! :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Now it worked, thanks for the quick reply! I need to read better the
documentation, but would be nice if each section of a group of functions
specify the needed libs to link. I'm sorry if they are already in the
documentation.
For anyone using QtCreator, in the .pro file, the following will work:
INCLUDEPATH += /home/user/libs/dlib-18.8
LIBS += -L/home/user/libs/dlib-18.8
LIBS += -pthread
LIBS += -lpng -ljpeg
CONFIG += link_pkgconfig
PKGCONFIG += x11
QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT
Hi,
I have same error, but I'm using VS 2010. I performed the following steps:
1) I build libjpeg using this tutorial http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html , include it to example program shows how dlib make an object detector :
1. in additional include dir folder containing jpeglib
2. in additional library dir folder with jpeg.lib (jpeg-9a\x64\Release)
3. in additional dependencies - jpeg.lib
2) I include to project dlib/all/source.cpp, it has the following lines :
ifdef DLIB_JPEG_SUPPORT
include "../image_loader/jpeg_loader.cpp" - highlighted !!
endif
It highlightes appeared after connecting libjpeg.
3)Succeeded build project, and get dlib_train.exe
4)Try to train with command dlib_train ../trainHog have same error :
exception thrown!
DLIB_JPEG_SUPPORT not #defined: Unable to load image in file tmp\images(1).jpg
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have to add the DLIB_JPEG_SUPPORT #define. If you are not
familiar with creating #defines in visual studio then you should use
cmake to setup your visual studio project. CMake will automatically
link in libjpeg and everything will work. See also http://dlib.net/compile.html
Cheers,
Davis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How can I #define DLIB_JPEG_SUPPORT.Got the same error as reported by Fedor,anyway I could build using cmake,ran some examples, great results. But it would be great if you could answer my query
Thanks
Last edit: Jithin 2014-09-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you use cmake it will generate an entire visual studio project for
you that is correctly configured. You can then open the project in
visual studio and do what you like. So I still recommend using cmake
if you are unfamiliar with visual studio's setup GUI. Additionally,
if you do this yourself you need to link your program with libjpeg.
There are a number of ways you can do this in visual studio, but the
easiest is to just add the files in dlib/external/libjpeg into your
project and also add the dlib/external/libjpeg folder into the include
search path. All these things are available through the right click
menu in the project bar.
There is a stack overflow question that mentions how to add
preprocessor definitions: http://stackoverflow.com/questions/9038738/preprocessor-definition-in-vs2010-for-c.
I don't remember off the top of my head the exact sequence of button
clicks that gets you to the "add this folder to the include search
path" but it's similar. But really, just use cmake if you are having
trouble navigating visual studio's setup GUI.
Cheers,
Davis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not sure what I'm doing wrong, but when I compile any new program that loads a image in the folder examples of dlib, I get the following error in run time:
it compile correctly but run time when i execute with commond ./a.out
Unable to load image in file faces/1.jpg.
You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.
yet i have defined #define DLIB_JPEG_SUPPORT in my program ex.cpp
The command I used is the following:
g++ -O3 -I.. ../dlib/all/source.cpp -lpthread -lX11 -ljpeg -lz ex.cpp
how can i do for whole program...what i have to do...i have to make changes in my program
plzzz sir...mene ap ka time tu waste kya but iam in difficulty...bz iam new in ubuntu
Last edit: Altaf Korejo 2016-10-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yes i have modified now by putting -D in my DLIB_JPEG SUPPORT....but i i have remove -D it is same as first
i have installed by typing following commond...inspite i have this error
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
i have installed cmake snap shot is as bellow in example folder where i have ex.cpp
sir if u tell me the commonds then i run those commands in my ubuntu terminal but now i do not know how to switch gcc compiler.. i have installed camke but same error...if u will help then Thanx...otherwise i have waste ur time...
Last edit: Altaf Korejo 2016-10-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm not sure what I'm doing wrong, but when I compile any new program that loads a image in the folder examples of dlib, I get the following error:
exception thrown: DLIB_JPEG_SUPPORT not #defined: Unable to load image in file test10.jpg
I get a similar error when I load a png image, with DLIB_PNG_SUPPORT
The command I used is the following:
g++ -O3 -I.. -lpthread -lX11 -lpng -ljpeg -lz img2edge.cpp -o img2edge
What is wrong? I'm sure that I have the libs png and jpeg loaded.
You need to add -DDLIB_JPEG_SUPPORT and -DDLIB_PNG_SUPPORT to the command line.
Cheers,
Davis
folllowing solution WORKED PERFECTLY for visual studio with dlib:
1. add all the source files inside the dlib/externel/jpeg folder to the project
2. include the path of "C:/ dlib/external/jpeg ", to ur additional include directories and additional library directories in general, and linker respectively.
3. add "DLIB_JPEG_SUPPORT" to C/C++ -> preprocessor-> preprocessor definitions
4. compile and run the program. it works!
Now it worked, thanks for the quick reply! I need to read better the documentation, but would be nice if each section of a group of functions specify the needed libs to link. I'm sorry if they are already in the documentation.
For anyone using QtCreator, in the .pro file, the following will work:
INCLUDEPATH += /home/user/libs/dlib-18.8
LIBS += -L/home/user/libs/dlib-18.8
LIBS += -pthread
LIBS += -lpng -ljpeg
CONFIG += link_pkgconfig
PKGCONFIG += x11
QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT
Anyway, the lib is very useful, good job! :)
No problem :)
Cheers,
Davis
On Fri, Jun 13, 2014 at 2:25 PM, icedecker icedecker@users.sf.net wrote:
Hi,
I have same error, but I'm using VS 2010. I performed the following steps:
1) I build libjpeg using this tutorial http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html , include it to example program shows how dlib make an object detector :
1. in additional include dir folder containing jpeglib
2. in additional library dir folder with jpeg.lib (jpeg-9a\x64\Release)
3. in additional dependencies - jpeg.lib
2) I include to project dlib/all/source.cpp, it has the following lines :
ifdef DLIB_JPEG_SUPPORT
include "../image_loader/jpeg_loader.cpp" - highlighted !!
endif
It highlightes appeared after connecting libjpeg.
3)Succeeded build project, and get dlib_train.exe
4)Try to train with command dlib_train ../trainHog have same error :
exception thrown!
DLIB_JPEG_SUPPORT not #defined: Unable to load image in file tmp\images(1).jpg
You have to add the DLIB_JPEG_SUPPORT #define. If you are not
familiar with creating #defines in visual studio then you should use
cmake to setup your visual studio project. CMake will automatically
link in libjpeg and everything will work. See also
http://dlib.net/compile.html
Cheers,
Davis
Thank you ! Adding define to VS helped me.
No problem :)
Hi Davis
I am using VS2010.
How can I #define DLIB_JPEG_SUPPORT.Got the same error as reported by Fedor,anyway I could build using cmake,ran some examples, great results. But it would be great if you could answer my query
Thanks
Last edit: Jithin 2014-09-20
If you use cmake it will generate an entire visual studio project for
you that is correctly configured. You can then open the project in
visual studio and do what you like. So I still recommend using cmake
if you are unfamiliar with visual studio's setup GUI. Additionally,
if you do this yourself you need to link your program with libjpeg.
There are a number of ways you can do this in visual studio, but the
easiest is to just add the files in dlib/external/libjpeg into your
project and also add the dlib/external/libjpeg folder into the include
search path. All these things are available through the right click
menu in the project bar.
There is a stack overflow question that mentions how to add
preprocessor definitions:
http://stackoverflow.com/questions/9038738/preprocessor-definition-in-vs2010-for-c.
I don't remember off the top of my head the exact sequence of button
clicks that gets you to the "add this folder to the include search
path" but it's similar. But really, just use cmake if you are having
trouble navigating visual studio's setup GUI.
Cheers,
Davis
Your answer was spot on Thanks Davis.
I'm not sure what I'm doing wrong, but when I compile any new program that loads a image in the folder examples of dlib, I get the following error in run time:
it compile correctly but run time when i execute with commond ./a.out
Unable to load image in file faces/1.jpg.
You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG files.
yet i have defined #define DLIB_JPEG_SUPPORT in my program ex.cpp
The command I used is the following:
g++ -O3 -I.. ../dlib/all/source.cpp -lpthread -lX11 -ljpeg -lz ex.cpp
What is wrong?
Last edit: Altaf Korejo 2016-10-08
You must #define DLIB_JPEG_SUPPORT for your whole program, not just for
some part of one file.
how can i do for whole program...what i have to do...i have to make changes in my program
plzzz sir...mene ap ka time tu waste kya but iam in difficulty...bz iam new in ubuntu
Last edit: Altaf Korejo 2016-10-08
-D
ok
Last edit: Altaf Korejo 2016-10-08
Have you modified dlib source files? Don't do that.
And since you don't know how to use gcc you should just use cmake. This
page litterally tells you what to type: http://dlib.net/compile.html
yes i have modified now by putting -D in my DLIB_JPEG SUPPORT....but i i have remove -D it is same as first
i have installed by typing following commond...inspite i have this error
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
i have installed cmake snap shot is as bellow in example folder where i have ex.cpp
sir this is the file which i have sent just now... how can i define for the whole program
Use the -D compiler switch
sir where i have to use -D to switch my compiler...How can i switch my compile and where i have to use this -D
http://bfy.tw/85vs :)
sir if u tell me the commonds then i run those commands in my ubuntu terminal but now i do not know how to switch gcc compiler.. i have installed camke but same error...if u will help then Thanx...otherwise i have waste ur time...
Last edit: Altaf Korejo 2016-10-08