Questions tagged [mat]

Use this tag for questions dealing with opencv cv::Mat (or cvMat) data structure. Use [mat-file] tag for Matlab binary file format. Use [matrix] tag for other types of 2D numeric data structures.

cv::Mat (or cvMat) is a basic data structure defined by to handle tabular (2D or 3D) numeric data.

DO NOT CONFUSE THIS TAG WITH
for general data structures for tabular numeric data.
for Matlab's binary file format.

941 questions
0
votes
1 answer

Why am I getting garbage value instead of RGB while printing out colour of pixels in OpenCV?

This snippet of code prints out garbage values. cv::Mat_::iterator it = img.begin(), itEnd = img.end(); for(; it != itEnd; ++it) std::cout << (*it)[1] << std::endl; But this prints out the vector of RGB…
web_ninja
  • 2,351
  • 3
  • 22
  • 43
0
votes
1 answer

Combine matrices using Mat opencv

I have 2 matrices as follows R = [1,0,0,0 0,1,0,0 0,0,1,0 0,0,0,1] and T = [1,0,0] Can I make a 4X4 Matrix from the above 2 in this format? [ R | T 0 0 0 1] This is basically obtaining the…
Lakshmi Narayanan
  • 5,220
  • 13
  • 50
  • 92
0
votes
2 answers

Double pointer of Mat initialization

I am trying to make a Mat array using OpenCV. The array is to store a number N of region of interest, and for each region I have to store the information of the last 5 frames. I'm trying to use a double pointer to Mat. The question is how do I…
0
votes
1 answer

Mat doesn't work with bitmap in Android OpenCV

I'm trying to implement some filters in a Bitmap with OpenCV in Android, the first step is detect a face and split in 2 images (eyes). But when I try implement a Mat function to do some Image processing it die. The error text is this: 08-05…
lojals
  • 981
  • 10
  • 19
0
votes
1 answer

Opencv - trouble creating matrix from other matrix (malloc.c:2451: sYSMALLOc: Assertion )

I'm creating a new Mat by jumping pixels of the original image, but I get this error: PRM algorithm: malloc.c:2451: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk,…
Bardo91
  • 585
  • 2
  • 7
  • 17
0
votes
1 answer

OpenCV- Cant access element of Mat (of descriptors)

I'm writing a simple program that extracts descriptors from images and writes them to files. I'm saving the descriptors in a Mat variable, but I'm getting wrong values when trying to access them. Here is the code: string s =…
GilLevi
  • 2,117
  • 5
  • 22
  • 38
0
votes
1 answer

Contracting number of columns in a image in opencv?

I have written code to convert an image to two part in Matlab as below img1=imge(1:M,1:0.55*N,:); img2=imge(1:M,0.55*N:N,:); here imge is my input image, I am trying to convert this code to opencv. I tried to use cv::Resize ,but that doesn't work.…
Ishant Mrinal
  • 4,898
  • 3
  • 29
  • 47
0
votes
1 answer

RGB mat to avi matlab

I have 300 frames of RGB mat data and I was wondering if there was a way to use videowriter to convert those mat frames into an avi file? I have tried using imwrite and videowriter but I cannot get the code to work.
zlangley
  • 25
  • 1
  • 5
0
votes
2 answers

How can I know the perspective transform matrix after findHomography

I'm new to OpenCV, and I'm doing something about image stitching. In the following code I want to know what the perspective transform matrix is and display the matrix, however I am getting the following errors. //-- Find the Homography cv::Mat H =…
user2567753
  • 39
  • 1
  • 5
0
votes
1 answer

Linking dll to c++ in qt for reading .mat files

I am using Qt Creator 2.4.1(Based on Qt 4.7.4) .. Now I want to open the .mat file which I got from Matlab. I am using the basic function matOpen Initially, I knew the headers required. They are mat.h, matrix.h and tmw.h. Now, before running the…
Sarat
  • 1
  • 1
0
votes
0 answers

Assign values to OpenCv matrix all at once

I simply want to set the elements of a matrix to a specific value, without doing deep or even shallow copies. As far as I’ve understood myMat = Mat::ones(rows, cols, CV_32SC1)*10; will allocate space on disk for a new matrix (same data type and…
Koleey
  • 113
  • 1
  • 1
  • 5
0
votes
1 answer

Figures in GUI Matlab

I am having a figure in a GUI matlab. When I run my code I make some plots in the figures. The thing is that I want to use my cursor to click on the plot and to display the coordinates but also the label of this point. And for the label I mean…
JPV
  • 1,079
  • 1
  • 18
  • 44
0
votes
2 answers

Opencv storing Yuyv (YCrCb) in cv::Mat

I'm the data I get out of my webcam is yuv422. I'd like to store this yuv422 into a cv::Mat without converting it to RGB... Is this possible? Thanks.
Jean-Luc
  • 3,563
  • 8
  • 40
  • 78
0
votes
2 answers

converting Mat to iplimage* in opencv

I am new in opencv and c++. what is the difference between iplimage and iplimage*? I used cvHaarDetectObjects that need iplimage* in arg[1]. I have a frame in the format of Mat. how could I convert Mt to iplimage*? (I found a way to convert mat…
es rashedi
  • 1
  • 1
  • 1
  • 1
0
votes
1 answer

Convert array^ to Mat

How do I convert an array^ to a Mat in openCV. I am being passed a array^ in c++/cli, but I need to convert it to Mat to be able to read it and display it.
fmvpsenior
  • 197
  • 7
  • 22