Ask Your Question

jtuffier's profile - activity

2014-06-04 16:21:44 -0600 asked a question what does the result of triangulatePoints() from openCV should looks like?

Hi,

I'm trying to triangulate some points from a stereo camera system.

First, I used the sample "stereo_calib" (cpp) to get the extrinsic parameters in a yml file :

  • R
  • T
  • R1
  • R2
  • P1
  • P2
  • Q

Is there a way to check if the values are correct ?

Then I use the method:

cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMat* projPoints2,    CvMat* points4D)

I used P1 for projMatr1 and P2 for projMatr2.

The point I want to triangulate is at coordinate x=919,y=686 on left image and x=586,y=694 on the right one. I tried this but I'm not sure if it's the good way:

int co1[] = {919,686};
Mat point1(2, 1, CV_32FC1, co1);
int co2[] = {586,694};
Mat point2(2, 1, CV_32FC1, co2);
Mat points4D;

I used point1 for projPoints1 and point2 for projPoints2. I wrote points4D in a yml file at the end. This is the result I got:

%YAML:1.0
Points4D: !!opencv-matrix
    rows: 4
    cols: 1
    dt: f
    data: [ 2.34857202e-001, 1.03716120e-001, -9.66480732e-001,
            1.43435571e-007 ]

What does it mean ? The three first values are x, y and z of the reconstruct point ? The values seems strange to me, but I'm really knew with openCV do I don't know much about it.

I found this related question: How to correctly use cv::triangulatePoints(). But it didn't really help me...

Thanks for the help !

2014-05-29 12:49:30 -0600 asked a question wrapper dll

Hi,

I'm trying to create a dll wrapper for using openCV in labview. I'm also pretty new with both of them (openCV & Labview). I would like to use the cvTriangulatePoints from labview. For now I've created a hpp file

#ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__

#include "cvconfig.h"

#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/core/internal.hpp"
#include "opencv2/features2d/features2d.hpp"
#include <vector>

#ifdef HAVE_TEGRA_OPTIMIZATION
#include "opencv2/calib3d/calib3d_tegra.hpp"
#else
#define GET_OPTIMIZED(func) (func)
#endif

#endif

(this is the precomp.hpp, it's include in the file triangulate.cpp opencv\sources\modules\calib3d\src)

then my own hpp file

#ifdef WRAPPEROPENCV_EXPORTS
#define WRAPPEROPENCV_API __declspec(dllexport) 
#else
#define WRAPPEROPENCV __declspec(dllimport) 
#endif

#include "precomp.hpp"

namespace WrapperOpenCv
{
    class WrapperOpenCv
    {
        public: 
            WRAPPEROPENCV_API void cvTriangulatePoints(CvMat* projMatr1, CvMat* projMatr2, CvMat* projPoints1, CvMat* projPoints2, CvMat* points4D);
            WRAPPEROPENCV_API void cvCorrectMatches(CvMat *F_, CvMat *points1_, CvMat *points2_, CvMat *new_points1, CvMat *new_points2);
            static WRAPPEROPENCV_API void triangulatePoints( InputArray _projMatr1, InputArray _projMatr2, InputArray _projPoints1, InputArray _projPoints2,  OutputArray _points4D )
    };
}

With this I should be able to export these methods in labview.(I know I still have to implement the functions in a cpp file). PROBLEM : I have an error on InputArray and OutputArray:

Error: identifier "InputArray" is undefined

Anybody knows what I should do to fix this ? Thanks for the help