dlib加载jpeg文件 [英] dlib load jpeg files
问题描述
我试图使用dlib库实现一个程序。我已经能够使用dlib的所有其他文件,除了与jpeg和png有关的文件。
I am trying to implement a program using dlib library. I have already been able to use dlib's all other files except the ones related to jpeg and png.
#include "dlib\image_io.h"
#define DLIB_JPEG_SUPPORT
int main(){
dlib::array2d<dlib::rgb_pixel> arr1;
dlib::load_jpeg(arr1,"sailboat1234.jpeg");
}
我已将 source.cpp
文件和 dlib / external
中的文件。我还包括到c + +一般包含 dlib
文件夹的 dlib-18.11
文件夹。
最后,该项目正在Visual studio 2012上运行。
I have included to my project the source.cpp
file and the ones inside the dlib/external
. Also i have included into c++ general the dlib-18.11
folder which contains the dlib
folder.
Lastly, the project is running on Visual studio 2012.
编辑:
程序错误:错误C2027:使用未定义类型'dlib :: compile_time_assert< value>'
。有任何想法吗?
When I run the program the error: error C2027: use of undefined type 'dlib::compile_time_assert<value>'
. Any ideas?
推荐答案
您需要在标题之前添加define才能产生任何效果:
You need to put the define before the headers for it to have any effect:
#define DLIB_JPEG_SUPPORT
#include "dlib\image_io.h"
参考请参阅此标题:
image_loader\jpeg_loader.h
这篇关于dlib加载jpeg文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!