Ask Your Question

Mainframe's profile - activity

2015-04-02 15:57:39 -0600 received badge  Popular Question (source)
2014-08-13 11:09:02 -0600 asked a question Finding a Projector real world position

I'm currently trying to discover the 3D position of a projector within a real world coordinate system. The origin of such a system is, for example, the corner of a wall. I've used Open Frameworks addon called ofxCvCameraProjectorCalibration that is based on OpenCV functions, namely calibrateCamera and stereoCalibrate methods. The application output is the following:

  • camera intrisic matrix (distortion coeficients included);
  • projector intrisic matrix (distortion coeficients included);
  • camera->projector extrinsic matrix;

My initial idea was, while calibration the camera, place the chessboard pattern at the corner of the wall and extract the extrinsic parameters ( [RT] matrix ) for that particular calibration. After calibrating both camera and projector do I have all the necessary data to discover the position of the projector in real world coordinates? If so, what's the matrix manipulation required to get it?

2014-08-12 04:42:27 -0600 commented question projectPoints example error

You're right boaz001, that was the problem, thanks for the feedback!

2014-08-11 11:26:28 -0600 commented question projectPoints example error

It crashes in the following line: cv::projectPoints(objectPoints, rVec, tVec, intrisicMat, distCoeffs, projectedPoints). I'm not doing any push_back to imagePoints, just ignore that For cycle (forgot to comment it) where that variable is used. The output of the program is every "cout" up to std::cout << "Distortion coef: " << distCoeffs << std::endl << std::endl (including).

2014-08-11 09:51:45 -0600 received badge  Editor (source)
2014-08-11 08:39:33 -0600 asked a question projectPoints example error

I'm currently trying to implement a example of OpenCV's projectPoints method. The idea behind this method is taking as input a set of 3D points, translation/rotation vector's of a given camera and its distortion coeficients, output the corresponding 2D points in the image plane. The source of code is as follows:

#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/highgui/highgui.hpp"

#include <iostream>
#include <string>

std::vector<cv::Point3d> Generate3DPoints();

int main(int argc, char* argv[])
{
// Read 3D points
std::vector<cv::Point3d> objectPoints = Generate3DPoints();
std::vector<cv::Point2d> imagePoints;

cv::Mat intrisicMat(3, 3, cv::DataType<double>::type); // Intrisic matrix
intrisicMat.at<double>(0, 0) = 1.6415318549788924e+003;
intrisicMat.at<double>(1, 0) = 0;
intrisicMat.at<double>(2, 0) = 0;

intrisicMat.at<double>(0, 1) = 0;
intrisicMat.at<double>(1, 1) = 1.7067753507885654e+003;
intrisicMat.at<double>(2, 1) = 0;

intrisicMat.at<double>(0, 2) = 5.3262822453148601e+002;
intrisicMat.at<double>(1, 2) = 3.8095355839052968e+002;
intrisicMat.at<double>(2, 2) = 1;

cv::Mat rVec(3, 1, cv::DataType<double>::type); // Rotation vector
rVec.at<double>(0) = -3.9277902400761393e-002;
rVec.at<double>(1) = 3.7803824407602084e-002;
rVec.at<double>(2) = 2.6445674487856268e-002;


cv::Mat tVec(3, 1, cv::DataType<double>::type); // Translation vector
tVec.at<double>(0) = 2.1158489381208221e+000;
tVec.at<double>(1) = -7.6847683212704716e+000;
tVec.at<double>(2) = 2.6169795190294256e+001;


cv::Mat distCoeffs(5, 1, cv::DataType<double>::type);   // Distortion vector
distCoeffs.at<double>(0) = -7.9134632415085826e-001;
distCoeffs.at<double>(1) = 1.5623584435644169e+000;
distCoeffs.at<double>(2) = -3.3916502741726508e-002;
distCoeffs.at<double>(3) = -1.3921577146136694e-002;
distCoeffs.at<double>(4) = 1.1430734623697941e+002;


std::cout << "Intrisic matrix: " << intrisicMat << std::endl << std::endl;
std::cout << "Rotation vector: " << rVec << std::endl << std::endl;
std::cout << "Translation vector: " << tVec << std::endl << std::endl;
std::cout << "Distortion coef: " << distCoeffs << std::endl << std::endl;


std::vector<cv::Point2f> projectedPoints;


cv::projectPoints(objectPoints, rVec, tVec, intrisicMat, distCoeffs, projectedPoints);

for (unsigned int i = 0; i < projectedPoints.size(); ++i)
{
    std::cout << "Image point: " << imagePoints[i] << " Projected to " << projectedPoints[i] << std::endl;
}

std::cout << "Press any key to exit.";
std::cin.ignore();
std::cin.get();

return 0;
}



std::vector<cv::Point3d> Generate3DPoints()
{
std::vector<cv::Point3d> points;

double x, y, z;

x = .5; y = .5; z = -.5;
points.push_back(cv::Point3d(x, y, z));

x = .5; y = .5; z = .5;
points.push_back(cv::Point3d(x, y, z));

x = -.5; y = .5; z = .5;
points.push_back(cv::Point3d(x, y, z));

x = -.5; y = .5; z = -.5;
points.push_back(cv::Point3d(x, y, z));

x = .5; y = -.5; z = -.5;
points.push_back(cv::Point3d(x, y, z));

x = -.5; y = -.5; z = -.5;
points.push_back(cv::Point3d(x, y, z));

x = -.5; y = -.5; z = .5;
points.push_back(cv::Point3d(x, y, z));


for(unsigned int i = 0; i < points.size(); ++i)
{
std::cout << points[i] << std::endl << std::endl;
}

return points;

}

The application crashes when I try to run the projectPoints ... (more)

2014-02-10 04:32:30 -0600 commented answer Error compiling OpenCV in VS2010

Sorry about the late reply, also was away this weekend. Anyway, problem solved, thanks for all your help Andrei and Steven!

2014-02-07 12:28:52 -0600 commented answer Error compiling OpenCV in VS2010

I know the directory "staticlib" isn't supposed to be added anywhere in the VS project configuration, it was just a long shot. Anyway for some reason he can't find those .PDB files corresponding to each .DLL file and I haven't found a solution for it yet.

2014-02-07 11:34:43 -0600 commented answer Error compiling OpenCV in VS2010

No, it solved all errors regarding Microsoft DLL files, however, it did not solve for the OpenCV DLL's.

Noticed that these PDB files he mentions are located in a directory (in my case, S:\OpenCV\build\x86\vc10\staticlib) but haven't found out a way to make use of that information. Tried to add that directory to the "Additional Library Directory" option within the Linker but no luck.

2014-02-07 10:30:57 -0600 commented answer Error compiling OpenCV in VS2010

Yep, got that output. Meanwhile I googled abit about this error and found out this:

On "Tools->Options->Debugging->Symbols and select checkbox "Microsoft Symbol Servers", Visual Studio will download PDBs automatically. "

Just did it and it now loaded properly all Windows DLL symbols. However it still won't work because there two DLL files from OpenCV that naturally MS Symbol list didn't had. With this being said, the errors are now:

'OpenCVTest.exe' (Win32): Loaded 'S:\OpenCV\build\x86\vc10\bin\opencv_core248d.dll'. Cannot find or open the PDB file.

'OpenCVTest.exe' (Win32): Loaded 'S:\OpenCV\build\x86\vc10\bin\opencv_highgui248d.dll'. Cannot find or open the PDB file.

Both files being the ones loaded in this particular OpenCVs test program.

2014-02-07 10:20:54 -0600 commented answer Error compiling OpenCV in VS2010

Sorry, edited my last post before I saw your reply. Anyway, both VS2010 and VS2013 have the exact same errors (check the list at my last post).

2014-02-07 10:04:53 -0600 commented answer Error compiling OpenCV in VS2010

Okey, got some progress now :) That fixed it but now got a whole new array of errors:

'TestOpenCV.exe': Loaded 'W:\Dropbox\Tese\Visual Studio Projects\Kinect\MyProjs\TestOpenCV\Debug\TestOpenCV.exe', Symbols loaded.

'TestOpenCV.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file

'TestOpenCV.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file

'TestOpenCV.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file

'TestOpenCV.exe': Loaded 'S:\OpenCV\build\x86\vc10\bin\opencv_core248d.dll', Cannot find or open the PDB file

This error list goes on for other DLL files...

2014-02-07 09:56:34 -0600 commented answer Error compiling OpenCV in VS2010

It seems there was one x64 setting... I fixed it and different error (only when running in Debug mode):

1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

Also, forgot to mention in the first post, not that it should make any difference but I don't have VS2010 SP1 installed and I also have VS2013 installed.

2014-02-07 09:21:07 -0600 commented answer Error compiling OpenCV in VS2010

Double checked it through the "Set" command on command line, only have one OpenCV environment variable:

OPENCV_DIR=S:\OpenCV\build\x86\vc10

2014-02-07 07:42:51 -0600 commented answer Error compiling OpenCV in VS2010

It's VS2010 32 Bits (correct me if I'm wrong but there is no 64 bits version, at least there wasn't one few years back and even now it's not available at MS DreamSpark website), the Windows is the only 64b software here.

2014-02-07 07:34:40 -0600 commented answer Error compiling OpenCV in VS2010

Huh, if I did a low vote on your comment Andrei, I assure you it wasn't intentional. Apologies. Regarding the comment itself, I already tried those settings but it didn't work.

2014-02-07 07:29:38 -0600 received badge  Critic (source)
2014-02-07 07:29:19 -0600 received badge  Supporter (source)
2014-02-06 12:22:51 -0600 asked a question Error compiling OpenCV in VS2010

I recently downloaded OpenCV and I haven't been able to compile the demo program. I downloaded the latest version and when compiling in VS2010 I get the following error:

1>Debug\opencv.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

It's a basic error but quite honestly I can't seem to find out what's causing it. I'm using the following software:

  • Windows7, 64 bit
  • VS2010
  • OpenCV 2.4.8

I followed all the steps from the installation tutorial, as follows:

Environment variable: OPENCV_DIR S:\OpenCV\build\x86\vc10 On Windows Path: S:\OpenCV\build\x86\vc10\bin

In VS2010:

  • At C/C++ "Additional include directories": S:\OpenCV\build\include
  • Linker->General->Additional Library Dependencies: $(OPENCV_DIR)\lib
  • Linker->Input->Additional Dependencies (for Debug):

opencv_core248d.lib opencv_imgproc248d.lib opencv_highgui248d.lib opencv_ml248d.lib opencv_video248d.lib opencv_features2d248d.lib opencv_calib3d248d.lib opencv_objdetect248d.lib opencv_contrib248d.lib opencv_legacy248d.lib opencv_flann248d.lib

  • Linker->Advanced->Target Machine: MachineX86

  • Linker->Command Line-> There is no /MACHINE:X64 there, only /MACHINE:X86

I did try to change these settings to run in 64 bits but I STILL get an error, only this time it's the opposite (instead of x86 conflicts with x64, i get x64 conflicts with x86). Tried to google for any way to solve this but haven't found a solution for my particular problem.

Any sort of help would be greatly appreciated.

Regards, Nuno