error: cannot convert ‘float*’ to ‘double*’ for argument ‘4’ to ‘int flandmark_detect(IplImage*, int*, FLANDMARK_Model*, double*, int*) [closed]

asked 2015-08-16 06:49:31 -0600

Tiras gravatar image

I will study CMake later. For now I will use everything in the same directory.
I git clone the repo and put the example which I copy the website, name it as 'sarit.cpp'.
My questions is :
1. Do you think the developer confuses his own function? If he does. How can I fix it?

$ g++ sarit.cpp `pkg-config --cflags --libs opencv`
sarit.cpp: In function ‘int main(int, char**)’:
sarit.cpp:22:57: error: cannot convert ‘float*’ to ‘double*’ for argument ‘4’ to ‘int flandmark_detect(IplImage*, int*, FLANDMARK_Model*, double*, int*)’
   flandmark_detect(img_grayscale, bbox, model, landmarks);

And here is is my pkg-config

$ pkg-config --libs --cflags opencv
-I/usr/include/opencv /usr/lib/x86_64-linux-gnu/libopencv_calib3d.so -lopencv_calib3d /usr/lib/x86_64-linux-gnu/libopencv_contrib.so -lopencv_contrib /usr/lib/x86_64-linux-gnu/libopencv_core.so -lopencv_core /usr/lib/x86_64-linux-gnu/libopencv_features2d.so -lopencv_features2d /usr/lib/x86_64-linux-gnu/libopencv_flann.so -lopencv_flann /usr/lib/x86_64-linux-gnu/libopencv_gpu.so -lopencv_gpu /usr/lib/x86_64-linux-gnu/libopencv_highgui.so -lopencv_highgui /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so -lopencv_imgproc /usr/lib/x86_64-linux-gnu/libopencv_legacy.so -lopencv_legacy /usr/lib/x86_64-linux-gnu/libopencv_ml.so -lopencv_ml /usr/lib/x86_64-linux-gnu/libopencv_objdetect.so -lopencv_objdetect /usr/lib/x86_64-linux-gnu/libopencv_ocl.so -lopencv_ocl /usr/lib/x86_64-linux-gnu/libopencv_photo.so -lopencv_photo /usr/lib/x86_64-linux-gnu/libopencv_stitching.so -lopencv_stitching /usr/lib/x86_64-linux-gnu/libopencv_superres.so -lopencv_superres /usr/lib/x86_64-linux-gnu/libopencv_ts.so -lopencv_ts /usr/lib/x86_64-linux-gnu/libopencv_video.so -lopencv_video /usr/lib/x86_64-linux-gnu/libopencv_videostab.so -lopencv_videostab

My file :

#include "flandmark_detector.h"
#include "cv.h"
#include "opencv/highgui.h"

int main(int argc, char * argv[])
{
  // load flandmark model structure and initialize
  FLANDMARK_Model * model = flandmark_init("flandmark_model.dat");

  // load input image
  IplImage *img = cvLoadImage("photo.jpg");

  // convert image to grayscale
  IplImage *img_grayscale = cvCreateImage(cvSize(img->width, img->height), IPL_DEPTH_8U, 1);
  cvCvtColor(img, img_grayscale, CV_BGR2GRAY);

  // bbox with detected face (format: top_left_col top_left_row bottom_right_col bottom_right_row)
  int bbox[] = {72, 72, 183, 183};

  // detect facial landmarks (output are x, y coordinates of detected landmarks)
  float * landmarks = (float*)malloc(2*model->data.options.M*sizeof(float));
  flandmark_detect(img_grayscale, bbox, model, landmarks);
}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-12 07:14:04.608287

Comments

3

it probably has to be:

 double * landmarks = (double*)malloc(2*model->data.options.M*sizeof(double));

also see here

berak gravatar imageberak ( 2015-08-16 07:09:58 -0600 )edit

@berak. Thank you.

Tiras gravatar imageTiras ( 2015-08-16 07:22:37 -0600 )edit
2

you need to compile & link the flandmark files, too ;)

 g++ flandmark_detector.cpp liblbp.cpp sarit.cpp `pkg-config --libs --cflags opencv`
berak gravatar imageberak ( 2015-08-16 07:22:58 -0600 )edit
1

@berak. Thank you so much! I was hitting the book about OO, CMake, and compilation with GCC. What a nightmare without your help.

Tiras gravatar imageTiras ( 2015-08-16 07:31:32 -0600 )edit