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
6
votes
2 answers

Convert char array to Opencv Mat

I have defined an array char buf[], and need to convert it into Opencv Mat. Is there a way? char buf[Max_size];
Electra
  • 71
  • 1
  • 1
  • 3
6
votes
2 answers

how to read Mat v7.3 files in python ?

I am trying to read the mat file given in the following website, ufldl.stanford.edu/housenumbers, in the file train.tar.gz, there is a mat file named digitStruct.mat. when i used scipy.io to read the mat file, it alerts me with the message ' please…
user824624
  • 7,077
  • 27
  • 106
  • 183
6
votes
2 answers

How to mask a float mat in opencv

I have a mat A of type CV_32F and a mask M with binary value 0 and 255. For example, A = [0.1 0.2; 0.3 0.4] M = [1 0 ; 0 0 ] I want to get the result of A&B = [0.1, 0;0 0] While bitwise operation does not work on float mat. And I tried to…
Frazer
  • 329
  • 1
  • 4
  • 17
6
votes
2 answers

Add the contents of 2 Mats to another Mat opencv c++

I just want to add the contents of 2 different Mats to 1 other Mat. I tried: Mat1.copyTo(newMat); Mat2.copyTo(newMat); But that just seemed to overwrite the previous contents of the Mat. This may be a simple question, but I'm lost.
fakeaccount
  • 933
  • 4
  • 13
  • 23
6
votes
1 answer

Mat and Vec_ types multiplication

Is there any easy way to multiplicate Mat and Vec_? (Provided, that they have proper sizes, e.g.: Mat_ M = Mat(3,3,CV_32F); Vec3f V=(1,2,3); result = M*V //? Maybe there is some easy method of creating row (or col) Mat based on Vec3?
Szał Pał
  • 306
  • 1
  • 7
  • 20
6
votes
2 answers

Java and OpenCV: Calculate Median / Mean / Stdev value of MAT (Gray-Image)

I've got an image as grayscale image using Mat m = Highgui.imread(path, Highgui.CV_LOAD_IMAGE_GRAYSCALE); in Java and now I want to calculate the median value, the mean value and the standard deviation. I'n new to this and I simply don't know how…
tim
  • 9,896
  • 20
  • 81
  • 137
6
votes
2 answers

Incomplete type "cv::Mat" opencv c++

I want to create a matrice in opencv for my project of raytracing. This is the code I have come up: #include "Windows.h" #include "core/mat.hpp" #include "core/core.hpp" #include "core/types_c.h" using namespace cv; Mat createImage() { Mat…
Ekica
  • 73
  • 1
  • 8
6
votes
3 answers

list file extensions supported by OpenCV

In OpenCV, I see imread() and VideoCapture() both take a string to a file path of multiple extensions. Is there a way to get a list of extensions that are supported by them? For example, getting a list of "jpg", "png", "mov", "mpg", etc.? I assume…
voodoogiant
  • 2,118
  • 6
  • 29
  • 49
6
votes
2 answers

cv::Mat matrix, HOW TO Reduce digits to the right of the decimal point in cv::Mat?

I have an app that prints a 3x3 cv::Mat on the iPhone screen. I need to reduce the decimals, as the screen is not so big, see: [1.004596557012473, -0.003116992336797859, 5.936915104939593; -0.007241746117066327, 0.9973985665720294,…
marcelosalloum
  • 3,481
  • 4
  • 39
  • 63
6
votes
1 answer

Bitmap to Mat gives wrong colors back

So I make a bitmap from a blob with the next code: byte[] blob = contact.getMP(); ByteArrayInputStream inputStream = new ByteArrayInputStream(blob); Bitmap bitmap = BitmapFactory.decodeStream(inputStream); Bitmap scalen =…
user1393500
  • 199
  • 1
  • 3
  • 16
6
votes
1 answer

Print coordinates and pixel values using Mouse callback

This is the code which i tried, only the coordinate values are printed but not the pixel values. #include #include #include void onMouse( int event, int x, int y, int, void*…
Karthik Murugan
  • 1,595
  • 4
  • 19
  • 26
6
votes
4 answers

OpenCV Mat array access, which way is the fastest for and why?

I am wondering about the way of accessing data in Mat in OpenCV. As you know, we can access to get data in many ways. I want to store image (Width x Height x 1-depth) in Mat and looping access each pixel in the image. Using ptr<>(irow) to get…
user951069
5
votes
2 answers

convert keypoints to mat or save them to text file opencv

I have extracted SIFT features in (opencv open source) and they are extracted as keypoints. Now, I would like to convert them to Matrix (With their x,y coordinates) or save them in a text file... Here, you can see a sample code for extracting the…
Mario
  • 1,469
  • 7
  • 29
  • 46
5
votes
0 answers

how to customize mat paginator

in my project i need to iterate through an array and display a single item at a time. The array navigation should be through a Next and a Previous button. I used mat table to achieve this along with mat paginator. Is there any way to customize the…
nivedita
  • 111
  • 2
  • 7
5
votes
2 answers

Complex Matlab struct mat file read by python

I know the version issues of mat files which correspond to different loading modules in python, namely scipy.io and h5py. I also searched a lot of similar problems like scipy.io.loadmat nested structures (i.e. dictionaries) and How to preserve…
Panfeng Li
  • 3,321
  • 3
  • 26
  • 34