Skip to content

Instantly share code, notes, and snippets.

@jimregan
Created March 25, 2012 16:02
Show Gist options
  • Save jimregan/2197847 to your computer and use it in GitHub Desktop.
Save jimregan/2197847 to your computer and use it in GitHub Desktop.
// http://www.cs.bilkent.edu.tr/~bilmdg/bilvideo-7/Software.html
//g++ -Wno-write-strings -shared -o libmpeg7.dylib -I. -I/opt/local/include/ -L/opt/local/lib/ $(find . -name "*c") $(find . -name "*cpp")
//g++ -Wno-write-strings -I. -I/opt/local/include/ -I /opt/local/include/opencv/ -L/opt/local/lib/ -L. -l mpeg7 -l opencv_core -l opencv_highgui main.cpp -o frd
#include <iostream>
#include "Feature.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
// Face Recognition
// input: frame->gray, where gray is the grayscale, normalized image of size 46x56
void computeWriteFRD( Frame* frame )
{
if(!frame)
return;
// compute the descriptor
FaceRecognitionFeature frf;
XM::FRD* frd = frf.getFaceRecognitionD( frame );
std::cout << "\n---- Face Recognition ---" << std::endl;
// write to screen: a vector of size 48
for( unsigned int i = 0; i < 48; i++)
std::cout << frd->eigenfeature[i] << " ";
std::cout << std::endl;
std::cout << "---------------" << std::endl;
// release the descriptor
delete frd;
}
int main( int argc, char* argv[] )
{
IplImage* image = 0;
image = cvLoadImage( argv[1] );
// create a Frame object (see include/Frame.h)
// allocate memory for 3-channel color and 1-channel gray image and mask
Frame* frame = new Frame( image->width, image->height, true, true, true);
// set the image of the frame
cv::Mat tmp(image);
frame->setImage(tmp);
// compute and display the descriptors for the 'image'
// CSD of size 32
computeWriteFRD(frame);
delete frame;
// destroy the windows
//cvDestroyWindow("image");
//cvDestroyWindow("mask");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment