dlib load jpeg files

怎甘沉沦 提交于 2019-12-13 13:09:54

问题


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");

} 

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.

EDIT:

When I run the program the error: error C2027: use of undefined type 'dlib::compile_time_assert<value>' . Any ideas?


回答1:


You need to put the define before the headers for it to have any effect:

#define DLIB_JPEG_SUPPORT
#include "dlib\image_io.h"

For reference see this header:

image_loader\jpeg_loader.h


来源:https://stackoverflow.com/questions/27803399/dlib-load-jpeg-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!