How to access elements by row, col in OpenCV 2.0's new "Mat" class? The documentation is linked below, but I have not been able to make any sense of it.
http://opencv.willowgarage.com/documentation/cpp/basic_structures.html#mat

Asked By neptune

How to access elements by row, col in OpenCV 2.0's new "Mat" class? The documentation is linked below, but I have not been able to make any sense of it.
http://opencv.willowgarage.com/documentation/cpp/basic_structures.html#mat

Asked By neptune

I want to create an adjacency matrix for a graph. Since I read it is not safe to use arrays of the form matrix[x][y] because they don't check for range, I decided to use the vector template class of the stl. All I need to store in the matrix are boolean v...

Asked By Lucas

When working with 1-channel (e.g. CV_8UC1) Mat objects in OpenCV, this creates a Mat of all ones: cv::Mat img = cv::Mat::ones(x,y,CV_8UC1).
However, when I use 3-channel images (e.g. CV_8UC3), things get a little more complicated. Doing cv::Mat img = cv:...

Asked By solvingPuzzles

I need to calculate the sum of two diagonals in a matrix in C++, I already have a solution for that but I must be dumb because I cant understand what it is doing, so I would like to know if there is another version which I can understand. here is the code...

Asked By Igor Ivanovski

I need to calculate the sum of two diagonals in a matrix in C++, I already have a solution for that but I must be dumb because I cant understand what it is doing, so I would like to know if there is another version which I can understand. here is the code...

Asked By Igor Ivanovski

I have done some pre processing for dft , and i am trying to save this image by imwrite.
My cropped image has this information
output.type() 5
output.channels() 1
output.depth() 5
But everytime when i save it gives blac...

Asked By wolvorinePk

I have done some pre processing for dft , and i am trying to save this image by imwrite.
My cropped image has this information
output.type() 5
output.channels() 1
output.depth() 5
But everytime when i save it gives blac...

Asked By wolvorinePk

How do you dynamically allocate a 2D matrix in C++?
I have tried based on what I already know:
#include <iostream>
int main(){
int rows;
int cols;
int * arr;
arr = new int[rows][cols];
}
It works for one parameter, but now for t...

Asked By chustar

In C, if I wanted to create a matrix struct, I would use:
struct matrix {
int col, row;
double data[1]; // I want the matrix entries stored
// right after this struct
}
Then I can allocate it with
matrix* allocate_matrix(int row,...

Asked By anon

I have the following code, which is a part of the algorithm that I am following. as you see I need to do some calculation for 10 different bands. and will end up with a matrix for each band that I need to recreate an image from it, the problem is that I d...

Asked By user261002

I have some MATLAB code that I want to migrate to OpenCV. The data that the MATLAB code uses is stored in a .mat file which is then loaded at run time.
I converted this .mat file into a .csv file and am then reading this data into OpenCV as a string usi...

Asked By Sid

In the openCV cheat sheet (C++), I have found the matrix opration mean(). When I use it:
float myMatMean = mean( MyMat );
I get the error:
no suitable conversion function from "cv::Scalar" to "float" exists
What can I do in order to use this data...

Asked By EyalG

I'm having some trouble printing the values of the descriptor matrix obtained through the use of the 'compute' method of any opencv descriptor extractor. I want to print the descriptor of a feature to a file one by one, but always when I access some eleme...

Asked By Alberto A

I am trying to take in an input for the dimensions of a 2D matrix. And then use user input to fill in this matrix. The way I tried doing this is via vectors (vectors of vectors). But I have encountered some errors whenever I try to read in data and append...

Asked By user1487000

I want to count the number of white points in a background image which is only black and white. I have a code like this:
int count = 0;
for ( int j = 0; j < Image.rows; j ++ )
{
for ( int i = 0; i < Image.cols; i ++ )
{
...

Asked By E_learner

In the openCV cheat sheet (C++), I have found the matrix opration mean(). When I use it:
float myMatMean = mean( MyMat );
I get the error:
no suitable conversion function from "cv::Scalar" to "float" exists
What can I do in order to use this data...

Asked By EyalG

I have a matrix that is dynamically being changed according to the following code;
for( It=all_frames.begin(); It != all_frames.end(); ++It)
{
ItTemp = *It;
subtract(ItTemp, Base, NewData);
cout << "The size of the new data for ";
...

Asked By JM92

If I have a matrix of type CV_32SC1, what typename should I use in function Mat::at?
e.g.
Mat X; // for example eye matrix of size 10,10,and type CV_32SC1
X.at<??????>(1,1)=5;
How can I find the typename for other matrix types?

Asked By Robert Kirchhoff

I have a matrix that is dynamically being changed according to the following code;
for( It=all_frames.begin(); It != all_frames.end(); ++It)
{
ItTemp = *It;
subtract(ItTemp, Base, NewData);
cout << "The size of the new data for ";
...

Asked By JM92