Ask Your Question

southpark's profile - activity

2018-07-11 21:18:09 -0600 received badge  Famous Question (source)
2016-09-23 20:13:46 -0600 received badge  Famous Question (source)
2015-10-15 22:30:00 -0600 received badge  Notable Question (source)
2015-08-11 06:40:52 -0600 received badge  Notable Question (source)
2015-02-25 06:08:51 -0600 received badge  Popular Question (source)
2015-01-12 09:36:12 -0600 received badge  Popular Question (source)
2013-01-26 16:14:40 -0600 commented answer copy selected row of a matrix to another

Thanks for your help. Your function runs pretty well. Later, I figured out the program was due to the generation of src matrix in the previous part of code. This part of code accidentally violate the address access. That causes the memory problem. Now I replace this part and everything works well.

I agree that there is not type as CV_32U.

2013-01-25 16:51:39 -0600 received badge  Student (source)
2013-01-25 13:57:14 -0600 answered a question Is there a list for new features needed for OpenCV?

Hi,

This is properly the latest information you can find about machine learning methods that are available in OpenCV.

http://docs.opencv.org/trunk/modules/ml/doc/ml.html

OpenCV 2.4.3.2 documentation » OpenCV API Reference »

Hope it helps.

2013-01-25 10:51:39 -0600 received badge  Scholar (source)
2013-01-25 09:38:20 -0600 commented answer copy selected row of a matrix to another

Thanks, Dniil. That was a silly mistake I made. The error has disappeared. However, the program still crashes in the middle. And the debug shows error in memcpy.asm

UnwindUp2: mov eax,[esi+ecx*4-8] ;U(entry)/V(not) - get dword from source ;V(entry) - spare

What was the underlying reason for this issue?

2013-01-25 07:53:52 -0600 commented answer compare two rows of a matrix

Thanks all the same. Later, I also figured out the problem.

2013-01-24 15:21:41 -0600 asked a question copy selected row of a matrix to another

Hi,

Thanks for answering my previous question. I have one more related issue.

I am still a little confused with the at operator for unknown type matrix.

 // copy select rows into a new matrix
 Mat indices; // n*1 matrix storing the row index, up to index 165600
 Mat dst;
 Mat src; // n*2 matrix

  void copy_matrix(Mat &src, Mat &dst, Mat &indices) {
  for (int i=0; i<indices.rows; i++) {
    // now copy the row vector
        Mat M1;
    src.row(indices.at<unsigned int>(i,1)).copyTo(M1);
    dst.push_back(M1);
   }
  }

The above code can pass the debug procedure. However, when I run the code, it gives the following error. The matrix indices has the data type int ( 0 to 4294967295). Therefore, the return type should be correct. I don't know which part goes wrong. I also tried at<int>, at<uchar> or other data types. But the error remains. Much appreciated for your help.

  Error: assertion failed, <dims <=2 && data && <unsigned> i0 << unsigned >size.p[0]

Update:

The error has disappeared. However, the program still crashes in the middle. And the debug shows error in memcpy.asm

UnwindUp2: mov eax,[esi+ecx*4-8] ;U(entry)/V(not) - get dword from source ;V(entry) - spare

What was the underlying reason for this issue?

2013-01-23 13:26:20 -0600 received badge  Editor (source)
2013-01-23 13:24:29 -0600 asked a question compare two rows of a matrix

Basically, I want to compare two rows from a matrix and return the logic values.

 Mat x(240, 320, CV_32F); // 240*320 image size
 Mat pairs(5, 2, CV_8U);  // 5*2 matrix, each row is a pair of row index from x
 int P  = pairs.rows;
 for (int j=0; j<P; j++) {
 z = (x.row(pairs(j,1)) > x.row(pairs(j,2)));
 }

It gives the following error,

   error C2664: 'cv::Mat cv::Mat::operator ()(const cv::Range *) const' : cannot convert parameter 1 from 'int' to 'const cv::Range *'

How to resolve this issue? Is it because the operator of row(int i) is wrong?

Thanks for your help.

2013-01-14 14:24:50 -0600 asked a question What is the difference between Vec<Mat> and Mat

Hi Guys,

I got confused with the usage of vector<mat> and Mat.

Example: vector<mat> images; images.push_back(imread("example.jpg")); //loop

bool CvSVM::train(const Mat& trainData, const Mat& responses, const Mat& varIdx=Mat(), const Mat& sampleIdx=Mat(), CvSVMParams params=CvSVMParams() )

For SVM, it requires the input to be Mat structure. How do you make the conversion?

Another question is with the usage of push_back.

"The methods add one or more elements to the bottom of the matrix. They emulate the corresponding method of the STL vector class. When elem is Mat , its type and the number of columns must be the same as in the container matrix."-from opencv.org

However, is push_back a concatenation operator or just grouping them into a cell structure? You can access data by images[0], images[1],...

If you define "Mat images" and then use images.push_back, the result is a concatenation of matrix.

Thanks for your clarification.

Sorry if the question seems naive.