Search the Community
Showing results for tags 'opencv'.
-
I listened with interest to this presentation by Wiebe Walstra: https://labviewwiki.org/wiki/GLA_Summit_2020/A_By-value_OpenCV_Library Does anyone know what the status of this is?
-
New Toolkit : OpenCV wrapper for Raspberry Pi (LinuxRT) for LabVIEW Great ! learning platform student and maker for learning machine vision application with LabVIEW. It's working with LabVIEW Home 2014 edition and required LINX 3.0 toolkit. You can run NI-VISION toolkit with Raspberry Pi board too. 1.QwaveCameraCV is a LabVIEW Camera Driver library for Raspberry Pi 3B/3B+ (LinuxRT) https://github.com/QWaveSystems/QwaveCameraCV 2.QwaveOpenCV is OpenCV wrapper functions for LabVIEW for Raspberry Pi 3B/3B+ (LinuxRT) https://github.com/QWaveSystems/QwaveOpenCV 3.QwaveOpenCV Examples using OpenCV (C/C++) and NI-VISION for Raspberry Pi 3B/3B+ (LinuxRT) https://github.com/QWaveSystems/QwaveOpenCV-Examples
- 6 replies
-
- 1
-
- vision
- raspberrypi
-
(and 1 more)
Tagged with:
-
Hi everyone. I wrote wrapper in Visual Studio for OpenCV calibrateCamera() function. Every operation like converting 1D array of points to vector<vector<Point2f>> etc, works ok, except most important thing. When function ()calibrateCamera is called, LabVIEW crashes. When this line is commented out, dll works ok (at least labview is still alive). Im out of ideas. I suspect that this is problem with memory management but i dont have an idea where it cames from. Function do not operate directly on data passed from LabVIEW. Ultimately I can compile code as exe and call it via cmd, but I'm curious why such a thing appears. Thanks for your precious time! Zyga dll source (if you need i can enclose some sample input data): #include <opencv2/core/core.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <extcode.h> using namespace cv; using namespace std; static void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f> &corners); static void arr2vect(float *APoints,int *Asize, vector<vector<Point2f>> &imagePoints); extern "C" { float __declspec(dllexport) Calibrate(float *APoints, int *Asize, int width, int height, float squareSize) { //initialize variables vector<vector<Point2f>> imagePoints; Size boardSize; boardSize.height = height; boardSize.width = width; Mat cameraMatrix = Mat::eye(3, 3, CV_64F), distCoeffs = Mat::zeros(1, 1, CV_64F); cameraMatrix.at<double>(0,0) = 1.0; vector<Mat> rvecs, tvecs; vector<vector<Point3f>> objectPoints(1); Size imageSize; imageSize.width = 2040; imageSize.height = 2040; arr2vect(APoints, Asize, imagePoints); // prepare imagePoints calcBoardCornerPositions(boardSize, squareSize, objectPoints[0]); //prepare objectPoints objectPoints.resize(imagePoints.size(),objectPoints[0]); //calibrate double rms = calibrateCamera(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs); return rms; } } //definitions static void arr2vect(float *APoints,int *Asize, vector<vector<Point2f>> &imagePoints) { int page = *(Asize); int row = *(Asize+1); int col = *(Asize +2); Point2f pointBuf; vector<Point2f> vectBuf; for (int i = 0; i<page; i++) { for (int j = 0; j<row; j++) { pointBuf.x = *(APoints + (i*(row*col))+j*2); pointBuf.y = *(APoints + (i*(row*col))+j*2+1); vectBuf.push_back(pointBuf); } imagePoints.push_back(vectBuf); vectBuf.clear(); } vectBuf.clear(); } static void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f> &corners) { corners.clear(); for( int i = 0; i < boardSize.height; ++i ) for( int j = 0; j < boardSize.width; ++j ) corners.push_back(Point3f(float( j*squareSize ), float( i*squareSize ), 0)); }