OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 13 Nov 2014 04:21:40 -0600how to read matrix from text file to Mat in opencvhttp://answers.opencv.org/question/42770/how-to-read-matrix-from-text-file-to-mat-in-opencv/Hi.. In my projec, I have to load matrix from a text file to MAt object in opencv. . Please help me in this regard..
eg
1 2 3
4 5 6
7 8 9
in text file. it should be loded to MatSAKHILETI SATYA KISHOREWed, 24 Sep 2014 02:22:38 -0500http://answers.opencv.org/question/42770/modify pixel of image with 0.01http://answers.opencv.org/question/50762/modify-pixel-of-image-with-001/hi,
i have a image i want to modify it each pixel of image having 0 value with 0.01. below is the code to replace the value 0 with 0.01. but it is not doing any thing.
code -
for (int y=0; y<contrast.rows; y++)
{
for (int x=0; x<contrast.cols; x++)
{
if(contrast.at<uchar>(y, x) ==0)
contrast.at<uchar>(y, x) = 0.01;
}
}
thanks
Deepak KumarThu, 13 Nov 2014 04:21:40 -0600http://answers.opencv.org/question/50762/most frequently occurring value in 2D matrixhttp://answers.opencv.org/question/44159/most-frequently-occurring-value-in-2d-matrix/Hi ,
I want to find the most frequently occurring value in a 2D matrix.
i was trying to use **std::max_element** but it didn't work because it is only works with a one dimension vector ..
could anybody help me please ?Eng HindSat, 11 Oct 2014 21:20:39 -0500http://answers.opencv.org/question/44159/(-13) Matrix error in Eigenfaces model (Face Recognizer)http://answers.opencv.org/question/43342/-13-matrix-error-in-eigenfaces-model-face-recognizer/Hi guys,
I've been experiencing this error on Eigenfaces.cpp:
OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) in reshape, file terminate called after trowing an instance of 'cv::Exception'
what (): /home/pi/opencv-2.4.8/modules/core/src/matrix.cpp: 802: error: (-13) The matrix is not continuous, thus its number of rows can not be changed in function reshape
I downloaded a pack of 400 faces, but I don't know what this error is about. It is about the faces, the filters or algorythm problem?
It is called on the 'reshape' method
// perform the PCA
PCA pca(data, Mat(), CV_PCA_DATA_AS_ROW, _num_components);
// copy the PCA results
_mean = pca.mean.reshape(1,1); // store the mean vector
Edit: I'm using OpenCv 2.4.8repopelinoWed, 01 Oct 2014 09:30:10 -0500http://answers.opencv.org/question/43342/How to Invert 3x2 Transformation Matrixhttp://answers.opencv.org/question/39311/how-to-invert-3x2-transformation-matrix/Hi,
i am having trouble inveting an 3x2 Transformation Matrix. If my original transformation is rotation with +5°, i want the inverse, which rotation is -5°.
Then i want to transform some point with the new inverse Matrix.
If I use
cv::Mat inverse;
inverse = H.inv(cv::DECOMP_SVD);
I get back a matrxi, but it is 2x3 instead of 3x2, and then i cannt use cv::transform anymore because it gets a SIGABRT.
What am i doing wrong ?
regard Peter pkohoutWed, 13 Aug 2014 03:35:28 -0500http://answers.opencv.org/question/39311/Calculate quality of a transformaionhttp://answers.opencv.org/question/35387/calculate-quality-of-a-transformaion/Hi,
i am using OpenCV to calculate a transformation (Rotation + Translation) between two 2D greyscale (pgm) pictures. Now we are looking for a way to calculate how good the transformation we got is. Is there something available in OpenCV to rate the resulting transformation matrix ? Or does somebody know some algorithm to achive this ?
pkohoutFri, 20 Jun 2014 04:07:52 -0500http://answers.opencv.org/question/35387/Matrix element-wise division: C = A/B when B != 0, 0 otherwise.http://answers.opencv.org/question/26201/matrix-element-wise-division-c-ab-when-b-0-0-otherwise/I want C = A/B when B != 0, 0 otherwise.
My test showed that the / operator does exactly what I want (with CV_32S mat).
It would be nice if this behavior were documented. How is divide() different from the / operator?
arthur.swTue, 07 Jan 2014 11:04:48 -0600http://answers.opencv.org/question/26201/2x3 Transformation Matrixhttp://answers.opencv.org/question/19146/2x3-transformation-matrix/Hi,
i would like to know how to read the information of a 2x3 Transformation Matrix.
If i am right, it contains the rotation, the translation x/y and the scale x/y.
But what is the sixth value used for ?
I need to read the rotation from the matrix in RAD or DEG.
I hope someone can explain me the 2x3 Transformation Matrix a little more detailed.
pkohoutTue, 20 Aug 2013 03:36:56 -0500http://answers.opencv.org/question/19146/Reshaping nxnx3 Mat Object to 3xn.nhttp://answers.opencv.org/question/17782/reshaping-nxnx3-mat-object-to-3xnn/Hi,
I have to multiply each and every pixel held in a mat object by a 3x3 Matrix (each pixel as in R, G, B values are to be processed. RGB values will make a 3x1 matrix, hence the matrix multiplication)
I don't want to use for-loops because that makes the code inefficient. So, one way I found out is to change nxnx3 Mat object to 3xn.n, can anybody tell me how to do that?
Thanks!
HaleemaTue, 30 Jul 2013 04:45:52 -0500http://answers.opencv.org/question/17782/