Ask Your Question

lingyun's profile - activity

2018-09-24 05:40:32 -0500 received badge  Popular Question (source)
2018-09-14 08:19:39 -0500 received badge  Notable Question (source)
2017-12-29 08:30:52 -0500 received badge  Popular Question (source)
2014-04-04 02:47:28 -0500 asked a question How to use function calcCovarMatrix ?

image description

I want to compute the covariance matrix using function calcCovarMatrix in java. The size of covariance matrix should be 22 ,but result coming from the code is 1010 . I can not see the fail! Could you tell me? Thanks in advance!

Here is my code:

double[] a= new double[]{1.5,2.3,3.0,1.7,1.2,2.9,2.1,2.2,3.1,3.1, 1.3, 2.7,2.0,1.7, 1.0,2.0,0.5,0.6,1.0,0.9};

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

Mat srcMat = Mat.zeros(10, 2, CvType.CV_64FC1);

srcMat.put(0,0,a);

System.out.println(srcMat.dump());

Mat Avg = Mat.zeros(2,1, CvType.CV_64FC1);

Mat COV = Mat.zeros(2,2,CvType.CV_64FC1);

Core.calcCovarMatrix(srcMat,COV,Avg,Core.COVAR_ROWS);

System.out.println(Avg.dump());

System.out.println(COV.dump());

2014-04-03 21:40:03 -0500 asked a question How can I use PCACompute and PCAProject in java?

I am trying to reduce vector size usig PCA in java. I am dealing with 40 objects(col), and each object has 644 feature vector(row). I want to reduce feature vector size 50% which means resultant feature vector would be (322). I use following code segment,but could not get the right answer. How can I reduce using PCACommpute and PCAProject? Thanks in advance.

code:

System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

float[] a= new float[]{(....};

Mat srcMat = new Mat(644,40,CvType.CV_32FC1);

srcMat.put(0,0,a);

Mat Avg = new Mat(1,644,CvType.CV_32FC1);

Mat EginenValue = new Mat(644,1,CvType.CV_32FC1);

Mat EigenVector = new Mat(644,644,CvType.CV_32FC1);

core.PCACompute(srcMat,Avg,EigenVector,322)

2014-03-08 18:32:53 -0500 commented question Mat data type is not compatible: 0

Thank you very much !

2014-03-06 23:01:18 -0500 asked a question Mat data type is not compatible: 0
float gaborMR[] = new float[gabor_height*gabor_width];
Mat gaborMatR = new Mat(gabor_height, gabor_width, CvType.CV_32FC1);
gaborMatR.put(0,0,gaborMR);
Mat GdstlenaR = new Mat(src.rows(),src.cols(), CvType.CV_32FC1);
Imgproc.filter2D(grayMat, GdstlenaR, src.depth(), gaborMatR);  
float gR[] = new float[src.rows()*src.cols()];
GdstlenaR.get(0, 0,gR); // here, it tells me:Mat data type is not compatible: 0

Hi! I don't know why this happend. Could you answer me? Thanks in advance!

2014-03-06 09:27:57 -0500 received badge  Editor (source)
2014-03-06 09:25:54 -0500 asked a question A dot-product of two matrices

Mat gaborMatR = new Mat(gabor_height, gabor_width, CvType.CV_32FC1); gaborMatR.put(0,0,gaborMR); Mat gaborMatI = new Mat(gabor_height, gabor_width, CvType.CV_32FC1); gaborMatI.put(0,0,gaborMI); Mat Gdstlena = new Mat(src.rows(),src.cols(), CvType.CV_32FC1);

Hi! I want to compute a dot-product of two matrices and put the result into Mat Gdstlenna. I know function 'dot(InputArray m)',but I don't know how to use it. Could you answer me? Thanks in advance!

2014-03-04 02:09:48 -0500 received badge  Student (source)
2014-03-04 02:08:49 -0500 commented answer How can I initialize Mat?

Thank you very much!

2014-03-04 02:07:54 -0500 received badge  Supporter (source)
2014-03-04 02:07:37 -0500 received badge  Critic (source)
2014-03-04 02:07:17 -0500 received badge  Scholar (source)
2014-03-03 23:53:26 -0500 asked a question How can I initialize Mat?

Mat gaborMat = new Mat(3, 3, CvType.CV_8UC1); float k[3][3] = { 1.0, -2.0, 1.0, 4.0, -2.0, -1.0, 4.0, -2.0, 2.0 } Hi! I am a fresh man here. Could I ask how I can initialize Mat with k[][]?