Как загрузить файл JPEG с помощью библиотеки DLIB?

После попытки запустить пример программы, загруженной из Вот, Я понимаю, для работы с файлами JPEG, я должен добавить #define DLIB_JPEG_SUPPORT директива к проекту. но перед этим необходимо скачать библиотеку jpeg и добавить ее в проект. Я сделал эти шаги:

1.Download jpegsr9a.почтовый индекс от Вот и расстегнул молнию.

2.Download win32.mak и вставьте его в корневую папку JPEG

3.Откройте командную строку разработчика из инструментов Visual Studio 2013

4.В командной строке введите: nmake -f makefile.vc setup-v10

5.После этих шагов jpeg.sln создан, примечание, когда я открываю jpeg.sln в VS2013, приходит сообщение:

введите описание изображения здесь

может быть, основа проблемы начинается отсюда, я не знаю

6. Создайте jpeg.sln с правильной конфигурацией (я собирал его много раз с разными конфигурациями, недавно я построил его, используя этот .)
в конце сборки произошла ошибка:«невозможно запустить jpeg.lib»
но в папке выпуска или папке отладки (зависит от конфигурации) был создан jpeg.lib

  1. Откройте основной проект, который использует DLIB для определения лица, я добавил корневую папку jpeg в каталог дополнительных включений и jepegroot / release в дополнительные каталоги библиотек, затем изменил зависимости UseLibrary на «да», а также добавил в зависимости jpeg.lib.

При построении проекта возникают ошибки:
введите описание изображения здесь

Это источник, который я пытаюсь собрать и запустить

//#define HAVE_BOOLEAN
#define DLIB_JPEG_SUPPORT
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>
#include<dlib/image_transforms.h>
#include <dlib/gui_widgets.h>
#include <dlib/image_io.h>
#include <iostream>
//
using namespace dlib;
using namespace std;

// ----------------------------------------------------------------------------------------

int main(int argc, char** argv)
{
try
{
// This example takes in a shape model file and then a list of images to
// process.  We will take these filenames in as command line arguments.
// Dlib comes with example images in the examples/faces folder so give
// those as arguments to this program.
if (argc == 1)
{
cout << "Call this program like this:" << endl;
cout << "./face_landmark_detection_ex shape_predictor_68_face_landmarks.dat faces/*.jpg" << endl;
cout << "\nYou can get the shape_predictor_68_face_landmarks.dat file from:\n";
cout << "http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2" << endl;
return 0;
}

// We need a face detector.  We will use this to get bounding boxes for
// each face in an image.
frontal_face_detector detector = get_frontal_face_detector();
// And we also need a shape_predictor.  This is the tool that will predict face
// landmark positions given an image and face bounding box.  Here we are just
// loading the model from the shape_predictor_68_face_landmarks.dat file you gave
// as a command line argument.
shape_predictor sp;
deserialize(argv[1])>>sp;image_window win, win_faces;
// Loop over all the images provided on the command line.
for (int i = 2; i < argc; ++i)
{
cout << "processing image " << argv[i] << endl;
array2d<rgb_pixel> img;
load_image(img, argv[i]);
// Make the image larger so we can detect small faces.
pyramid_up(img);

// Now tell the face detector to give us a list of bounding boxes
// around all the faces in the image.
std::vector<rectangle> dets = detector(img);
cout << "Number of faces detected: " << dets.size() << endl;

// Now we will go ask the shape_predictor to tell us the pose of
// each face we detected.
std::vector<full_object_detection> shapes;
for (unsigned long j = 0; j < dets.size(); ++j)
{
full_object_detection shape = sp(img, dets[j]);
cout << "number of parts: " << shape.num_parts() << endl;
cout << "pixel position of first part:  " << shape.part(0) << endl;
cout << "pixel position of second part: " << shape.part(1) << endl;
// You get the idea, you can get all the face part locations if
// you want them.  Here we just store them in shapes so we can
// put them on the screen.
shapes.push_back(shape);
}

// Now let's view our face poses on the screen.
win.clear_overlay();
win.set_image(img);
win.add_overlay(render_face_detections(shapes));

// We can also extract copies of each face that are cropped, rotated upright,
// and scaled to a standard size as shown here:
dlib::array<array2d<rgb_pixel> > face_chips;
extract_image_chips(img, get_face_chip_details(shapes), face_chips);
win_faces.set_image(tile_images(face_chips));

cout << "Hit enter to process the next image..." << endl;
cin.get();
}
}
catch (exception& e)
{
cout << "\nexception thrown!" << endl;
cout << e.what() << endl;
}
}

// ———————————————— —————————————-

Я могу выбрать другие альтернативы, но я трачу слишком много времени, чтобы достичь здесь, я хочу знать, как я могу решить эту проблему и загрузить файл JPEG при использовании DLIB

Я также прочитал эти ссылки:

Компиляция libjpeg

http://www.dahlsys.com/misc/compiling_ijg_libjpeg/index.html

Dlib загрузить файлы JPEG

http://sourceforge.net/p/dclib/discussion/442518/thread/8a0d42dc/

1

Решение

Я решил свою проблему по инструкции ниже, пожалуйста, следуйте ей.

— Добавить каталог включения в VC ++
введите описание изображения здесь

— Включить source.cpp

введите описание изображения здесь

— Добавить добавить файлы в dlib / external / libjpeg в проект

введите описание изображения здесь

— Определить в препроцессоре

введите описание изображения здесь

— Вам не нужно использовать дополнительную библиотеку.

2

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector