Ask Your Question
0

what is wrong with the below code ? Crashes on "cv::projectPoints"line in release mode, does not crash in debug mode but "cv::projectPoints" function does not function. [closed]

asked 2017-01-21 08:20:39 -0600

Oguz gravatar image

updated 2017-01-21 08:22:43 -0600

LBerger gravatar image
#include <opencv2/opencv.hpp>
#include <dlib/image_processing.h>
#include <dlib/gui_widgets.h>
#include <dlib/image_io.h>
#include <dlib/dir_nav.h>
#include <dlib/opencv.h>
#include <iostream>
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>

using namespace dlib;
using namespace std;
using namespace cv;

Scalar red(0, 0, 255);
Scalar green(0, 255, 0);
Scalar blue(255, 0, 0);
Scalar yellow(0, 255, 255);

double  FACE_DOWNSAMPLE_RATIO = 2.0;
int     SKIP_FRAMES = 2;

void nokta_koy(const int bas, const int bit, full_object_detection shape, std::vector<cv::Point2d>* par);

int main(int argc, char** argv)
{

cv::Mat frame;
cv::VideoCapture cap;
cap.open("video/Woman03.mp4");
// float 32 bit
// double 64 bit
std::vector<cv::Point2f> kpoints_2d;
kpoints_2d.push_back(cv::Point2f(40.00f, 31.57863f));
std::vector<cv::Point3f> kpoints_3d;
kpoints_3d.push_back(cv::Point3f(40.00f, 31.57863f,20.00f));

std::vector<cv::Point2d> points_2d;
std::vector<cv::Point3d> points_3d;
// Left eyebrow     17 = 21;
points_3d.push_back(cv::Point3d(-22.33010, 31.18483, 14.48982));
points_3d.push_back(cv::Point3d(-21.13250, 30.87293, 14.94626));
points_3d.push_back(cv::Point3d(-19.58109, 30.82237, 15.09587));
points_3d.push_back(cv::Point3d(-18.50974, 31.03186, 14.68483));
points_3d.push_back(cv::Point3d(-17.17672, 31.55783, 14.03172));
// Right eyebrow    22 = 26;
points_3d.push_back(cv::Point3d(-12.24395, 33.62098, 14.00198));
points_3d.push_back(cv::Point3d(-10.66202, 34.28308, 14.78618));
points_3d.push_back(cv::Point3d(-9.45469, 35.27701, 15.08884));
points_3d.push_back(cv::Point3d(-8.72852, 36.25310, 15.00331));
points_3d.push_back(cv::Point3d(-8.10672, 37.56454, 14.63086));
// Nose bridge      27 = 30;
points_3d.push_back(cv::Point3d(-14.73220, 32.31916, 12.17609));
points_3d.push_back(cv::Point3d(-14.39165, 31.89311, 9.46658));
points_3d.push_back(cv::Point3d(-13.64990, 30.19387, 6.50432));
points_3d.push_back(cv::Point3d(-13.63577, 29.96962, 5.79795));
// Lower nose       31 = 35;
points_3d.push_back(cv::Point3d(-16.76307, 31.30655, 4.26300));
points_3d.push_back(cv::Point3d(-15.79540, 31.64108, 4.09090));
points_3d.push_back(cv::Point3d(-14.49324, 31.98343, 3.51114));
points_3d.push_back(cv::Point3d(-13.32834, 32.65988, 3.99250));
points_3d.push_back(cv::Point3d(-12.51400, 33.40477, 4.02762));
// Let eye          36 = 41;
points_3d.push_back(cv::Point3d(-22.88804, 32.08460, 11.35419));
points_3d.push_back(cv::Point3d(-21.30383, 31.52723, 11.85955));
points_3d.push_back(cv::Point3d(-19.53373, 31.91928, 12.00906));
points_3d.push_back(cv::Point3d(-18.71059, 32.92976, 11.02460));
points_3d.push_back(cv::Point3d(-19.47160, 32.26871, 10.42905));
points_3d.push_back(cv::Point3d(-21.24849, 31.57863, 10.44351));
// Right eye        42 = 47;
points_3d.push_back(cv::Point3d(-12.63167, 35.37018, 10.82787));
points_3d.push_back(cv::Point3d(-10.99759, 35.54239, 11.70073));
points_3d.push_back(cv::Point3d(-9.34893, 36.14645, 12.01417));
points_3d.push_back(cv::Point3d(-8.69870, 37.68277, 11.43927));
points_3d.push_back(cv::Point3d(-9.65058, 36.23913, 10.72708));
points_3d.push_back(cv::Point3d(-11.07719, 35.74884, 10.58645));

cap >> frame;
cv::resize(frame, frame, cv::Size(), double(1.0 / FACE_DOWNSAMPLE_RATIO), double(1 ...
(more)
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LBerger
close date 2017-01-21 09:15:06.292081

Comments

Thnks for the reply. Win 32, c++, visual studio 2015.

Oguz gravatar imageOguz ( 2017-01-21 08:39:24 -0600 )edit
1

It worked. Thnk you for the help.

Oguz gravatar imageOguz ( 2017-01-21 09:11:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-21 08:27:43 -0600

LBerger gravatar image

updated 2017-01-21 08:28:20 -0600

If your platform is windows check dll. in release you mustn't use opencv_xxxd.dll (xxx is module name)

please read FAQ :

Try to state your operating system (32 bit or 64 bit), the OpenCV version, the options that you used while building. Mention also which programming language you are using. All this information can help forum assistants to quickly search for a specific solution, rather than searching for a general one.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-01-21 08:20:39 -0600

Seen: 490 times

Last updated: Jan 21 '17