Skip to content

Instantly share code, notes, and snippets.

@dboyliao
Last active October 27, 2017 05:34
Show Gist options
  • Save dboyliao/95fafe895cefbeed469bc4e2460d9a49 to your computer and use it in GitHub Desktop.
Save dboyliao/95fafe895cefbeed469bc4e2460d9a49 to your computer and use it in GitHub Desktop.
Header for convert UIImage to dlib image (2d pixel array) and vise versa
//
// dlib_ios.h
// TryDlibVideoStream
//
// Created by DboyLiao on 13/03/2017.
//
#ifndef dlib_ios_h
#define dlib_ios_h
#include "dlib/pixel.h"
#include "dlib/array2d/array2d_kernel.h"
void UIImageToDlibImage(const UIImage* uiImage, dlib::array2d<dlib::bgr_pixel>& dlibImage, bool alphaExists = false);
UIImage* DlibImageToUIImage(dlib::array2d<dlib::bgr_pixel>& dlibImage);
#endif /* dlib_ios_h */
@dboyliao
Copy link
Author

The implementation is here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment