from MAT to BIDIMENSIONAL ARRAY
Does a function doing this work exists? I need to change a Mat objecto into a bidimensional array to work with every element.
Thanks to help
Does a function doing this work exists? I need to change a Mat objecto into a bidimensional array to work with every element.
Thanks to help
if it's actually a bidimensional Array, you could even try to make a Mat from that:
Mat m1 = Mat::ones(3,3,CV32F); // placeholder for your mat there
float bd_arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
Mat m2(3,3,CV_32F,bd_arr);
Mat m3 = m1 * m2;
note, that this won't work with an array of pointers, a dynamically allocated 2d array like this:
float **bad = new float*[3];
bad[0] = new float[3];
bad[1] = new float[3];
bad[2] = new float[3];
(totally different memory layout)
A mat object is 2 D or 3 D array , if we consider that your mat object is 2 D so it is obligatory an array with dimension 2 , you can access to each element in your object mat "im" using for example :
for (int i = 0; i < im.rows; i++)
{
for (int j = 0; j < im.cols; j++)
{
uchar p1 = im.at<uchar>(i, j);// you can access to each element (row/col)
}
}
for (int i = 0; i < rows; i++){
for (int j = 0; j < cols; j++){
imfft=imfft*filter[i][j]
}}
I have to multiply an array with a mat
Asked: 2013-05-28 10:30:26 -0600
Seen: 411 times
Last updated: May 28 '13
Apply a function to every Mat element
How to reduce false positives for face detection
OpenCV DescriptorMatcher matches
Record/Store constant refreshing coordinates points into notepad
Conversion between IplImage and MxArray
How can solvePnPRansac be used with double values?
Combine SIFT with other method for object recognition
if I pass to a function a Mat object ass a Mat **name , after can i transfer every element to a bidimensional array?
I have to multiply a Mat with a bidimensional array