Ask Your Question

RPH's profile - activity

2019-08-26 04:15:12 -0500 commented question OpenCV 4.1.1 Imread() & Imwrite() Crashes Program Immediately [Qt] ?

@StevenPuttemans I don't know, all my other Qt projects run fine through Qt when using older versions of OpenCV.

2019-08-23 04:14:54 -0500 commented question OpenCV 4.1.1 Imread() & Imwrite() Crashes Program Immediately [Qt] ?

@StevenPuttemans I managed to get it working on the other machine by copying the correct DLLs over. However, it is still

2019-08-21 11:49:44 -0500 commented question OpenCV 4.1.1 Imread() & Imwrite() Crashes Program Immediately [Qt] ?

@StevenPuttemans What is very strange is that running the program from inside Qt I get the error: "The program has unexp

2019-08-19 09:18:28 -0500 commented question OpenCV 4.1.1 Imread() & Imwrite() Crashes Program Immediately [Qt] ?

@StevenPuttemans Yes, it doesn't even get that far. The program doesn't even start. Just having the imread function caus

2019-08-19 04:33:21 -0500 asked a question OpenCV 4.1.1 Imread() & Imwrite() Crashes Program Immediately [Qt] ?

OpenCV 4.1.1 Imread() & Imwrite() Crashes Program Immediately [Qt] ? Hi, I have built OPENCV v4.1.1 from source for

2019-03-08 05:09:40 -0500 edited question Wrap OpenCV Mat as numpyarray hangs ?

Wrap OpenCV Mat as numpyarray hangs ? Hi, I am using opencv v3.4.2 with QT Creator IDE in C++. I am trying to wrap an

2019-03-08 05:09:17 -0500 edited question Wrap OpenCV Mat as numpyarray hangs ?

Wrap OpenCV Mat as numpyarray hangs ? Hi, I am using opencv v3.4.2 with QT Creator IDE in C++. I am trying to wrap an

2019-03-08 05:08:34 -0500 commented question Wrap OpenCV Mat as numpyarray hangs ?

@berak There is no error message. It just sits there and doesn't go past that point. The program does not crash either.

2019-03-08 05:07:17 -0500 edited question Wrap OpenCV Mat as numpyarray hangs ?

Wrap OpenCV Mat as numpyarray hangs ? Hi, I am using opencv v3.4.2 with QT Creator IDE in C++. I am trying to wrap an

2019-03-08 05:04:11 -0500 edited question Wrap OpenCV Mat as numpyarray hangs ?

Wrap OpenCV Mat as numpyarray hangs ? Hi, I am using opencv v3.4.2 with QT Creator IDE in C++. I am trying to wrap an

2019-03-08 05:03:18 -0500 asked a question Wrap OpenCV Mat as numpyarray hangs ?

Wrap OpenCV Mat as numpyarray hangs ? Hi, I am using opencv v3.4.2 with QT Creator IDE in C++. I am trying to wrap an

2019-03-08 04:47:55 -0500 commented question Pass Mat to Python Script ?

@Jessie @mandarin In opencv v2 import_array() has to be in a void function. In opencv v3 it has to be in a bool function

2018-11-02 07:30:16 -0500 commented question Pass Mat to Python Script ?

@saranya11 What errors ? Did you link and include the necessary python libraries. You need: #include <Python.h> #

2018-05-21 08:19:11 -0500 commented question Pass Mat to Python Script ?

Nevermind, I solved it by adding the line: import_array(); to my main function.

2018-05-21 07:53:40 -0500 commented question Pass Mat to Python Script ?

@berak I'm using the built in OpenCV wrapper pyopencv_from() included in "modules\python\src2\cv2" to wrap the Mat as a

2018-05-21 07:52:29 -0500 commented question Pass Mat to Python Script ?

@berak I'm using the built in OpenCV wrapper pyopencv_from() included in "modules\python\src2\cv2" but my program crashe

2018-05-21 03:20:28 -0500 commented question Pass Mat to Python Script ?

@berak Anymore info on this ?

2018-05-20 16:15:21 -0500 received badge  Popular Question (source)
2018-05-18 11:05:57 -0500 commented question Pass Mat to Python Script ?

No, I need to use C++ because it's a GUI program. I cannot convert the python code to C++ either. There are 3 programs

2018-05-18 08:37:04 -0500 commented question Pass Mat to Python Script ?

Ok, maybe it's better for me to explain at a high level what I'm trying to achieve, then you can let me know if it's pos

2018-05-18 07:18:28 -0500 commented question Pass Mat to Python Script ?

Hi, I'm not trying to write my own wrapper. I was just following the guide here: Embedding Python in Another Application

2018-05-18 07:14:12 -0500 edited question Pass Mat to Python Script ?

Pass Mat to Python Script ? Hi, I am using OpenCV v2.4.13.6 with C++ in QT Creator. I am trying to pass an OpenCV Mat ob

2018-05-18 06:57:24 -0500 received badge  Organizer (source)
2018-05-18 06:55:50 -0500 asked a question Pass Mat to Python Script ?

Pass Mat to Python Script ? Hi, I am using OpenCV v2.4.13.6 with C++ in QT Creator. I am trying to pass an OpenCV Mat ob

2018-03-15 07:05:33 -0500 commented question Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ?

@berak Nope, I have tried it from scratch many times before. Each time I've tried something different but it never works

2018-03-15 06:16:25 -0500 commented question Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ?

@berak g++ (x86_64-posix-seh, Built by strawberryperl.com project) 7.1.0 Copyright (C) 2017 Free Software Foundation, In

2018-03-15 06:12:22 -0500 edited question Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ?

Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ? Hi, I am trying to setup the OpenCV image pr

2018-03-15 06:07:31 -0500 edited question Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ?

Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ? Hi, I am trying to setup the OpenCV image pr

2018-03-15 06:06:53 -0500 commented question Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ?

@berak How would I go about doing that with CMAKE-GUI ? I forgot to mention that OpenCV v2.4.13.6 compiles/builds withou

2018-03-15 05:27:10 -0500 asked a question Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ?

Linking CXX shared library ..\..\bin\libopencv_core341.dll CMAKE/QT ERROR ? Hi, I am trying to setup the OpenCV image pr

2016-06-29 11:07:31 -0500 commented answer PCA + SVM ?

@sturkmen @berak Does the code above look alright ? Thanks

2016-06-28 17:35:33 -0500 commented answer PCA + SVM ?


/* When Testing */
Mat testData = Mat(1, 21504, CV_32FC1, cv::Scalar(0)); //Assume populated
PCA pca;
FileStorage fs(pca_filename, FileStorage::READ);
fs["mean"] >> pca.mean;
fs["e_vectors"] >> pca.eigenvectors;
fs["e_values"] >> pca.eigenvalues;
fs.release();
Mat test_projected;
pca.project(testData, test_projected); // should result in a 512 x 1 Mat
int label = svm.predict(test_projected);

2016-06-28 17:28:48 -0500 commented answer PCA + SVM ?


/* When Training */
Mat trainingData = Mat(213, 21504, CV_32F, cv::Scalar(0)); //assume populated
Mat projection_result;
PCA pca(trainingData, Mat(), CV_PCA_DATA_AS_ROW, 512);
pca.project(trainingData, projection_result);
FileStorage fs(pca_filename, FileStorage::WRITE);
fs << "mean" << pca.mean;
fs << "e_vectors" << pca.eigenvectors;
fs << "e_values" << pca.eigenvalues;
fs.release();
CvSVM svm;
svm.train(projection_result, labels, Mat(), Mat(), params);

2016-06-28 17:28:25 -0500 marked best answer PCA + SVM ?

Hi, I am trying to reduce the dimensionality of my feature set using PCA and then classification using SVM.

I have created and populated my feature matrix and label matrix :

  Mat labels(875, 1, CV_32F);

  Mat trainingData(875, 23040, CV_32F);

Where each row corresponds to an image and each column is a feature. The features are histogram bins (256) from multiple regions in the image (90 regions). 90x256 = 23040.

I now want to reduce the 23040 features to something less before training, say 512 features. I have this:

/*Reduce dimensionality using PCA*/

Mat projection_result;

PCA pca(trainingData, Mat(), CV_PCA_DATA_AS_ROW,512);

pca.project(trainingData, projection_result);

/*Classification*/

CvSVMParams params;
params.svm_type = CvSVM::C_SVC;
params.kernel_type = CvSVM::RBF;

CvSVM SVM;
SVM.train_auto(projection_result, labels, Mat(), Mat(), params);

SVM.save("trainedData_test.xml");

My question is, is this correct ? And how would I now use prediction with PCA ?

/*Load SVM*/

CvSVM SVM;
SVM.load("trainedData_test.xml");


/*Populate test matrix*/

  Mat testData(1, 23040, CV_32F);

/*PCA ???*/

/*Classify*/

int label = SVM.predict(projection_result ???);

Thanks !