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
4
votes
1 answer

view cv::Mat data while debugging in Visual Studio Code

I need to check elements of some cv::Mats while debugging my OpenCV C++ code. Tried adding mymat.at(0, 0) to watch but there are two problems: Sometimes it doesn't work: Couldn't find method cv::Mat::at Even if it works, it is very…
AmirSina Mashayekh
  • 498
  • 1
  • 5
  • 21
4
votes
0 answers

OpenCV - How to push back Mat in a queue?

I am trying to put the frames of a video in a deque. This code does not work. Because the back and front of the queue are both the same as the current frame. deque frameSeq; int main() { Mat frame; VideoCapture video("path to video"); …
Hadi GhahremanNezhad
  • 2,377
  • 5
  • 29
  • 58
4
votes
2 answers

Extract depth frame from RealSense camera?

i want to get continuous distance frames from the intel realsense camera. so, i want to generate a Mat object (1 channel) with size 1280*720 (should be the resolution of the 415 realsense cam). this matrix should content only the distance…
apct
  • 81
  • 1
  • 5
4
votes
1 answer

Automatic processing of dymola simulation results with Python

I want to automatically evaluate my simulation results with a python script, but struggle to open the .mat-Files in a meaningful way. Opening the files with scipy.loadmat doesn't seem to be a viable option: from scipy.io import loadmat x =…
Phil
  • 624
  • 7
  • 19
4
votes
0 answers

can mat(memory analyze tool) display primitive types in a heapdump

I want to see the stack frame of a method from a heapdump using mat. But I can't see any primitive type in the callstack, but types like String can be displayed from the threadDetail. public int fun(int x, int y) { int d = this.hashCode(); …
Xinli Niu
  • 471
  • 1
  • 4
  • 6
4
votes
1 answer

OpenCV Convert Bitmap to Mat

I'm working with c# and OpenCV. I have a Bitmap that I want to write as a frame of video using the VideoWriter provided by OpenCV. I've done this in Python so know it will work. I just need the conversion step from Bitmap to Mat. My (partial) code…
Mike from PSG
  • 5,312
  • 21
  • 39
4
votes
1 answer

Integer division between an Image taken from a VideoCapture of OpenCV and a scalar

I'm using version OpenCV 3.2. I open the default camera: VideoCapture cap; cap.open(0); and grab the current frame: Mat frame; cap.read(frame); Now I want to reduce the number of colours shown in the image. Thus, I do an integer division and…
Santiago Gil
  • 1,292
  • 7
  • 21
  • 52
4
votes
3 answers

Convert between OpenCV Mat and Leptonica Pix

I need to convert between OpenCV Mat image and Leptonica Pix image formats in C++. This is being used for binarization of 8bit gray images.
loot
  • 150
  • 1
  • 9
4
votes
0 answers

Initializing cv::Mat with negative step to flip image vertically

I have a vertically flipped RGBA image stored in uchar[] raw_data, but I need it in grayscale cv::Mat. This can be easily achieved using following code: cv::Mat src(width, height, CV_8UC4, raw_data), tmp, dst; cvtColor(src, tmp,…
pigeonR
  • 41
  • 3
4
votes
1 answer

OpenCV not recognizing Mat size

I'm trying to print an image using OpenCV defining a 400x400 Mat: plot2 = cv::Mat(400,400, CV_8U, 255); But when I try print the points, something strange happens. The y coordinate only prints to the first 100 values. That is, if I print the point…
user6375350
  • 95
  • 1
  • 8
4
votes
1 answer

OpenCV for Android - Mat.get(row, col, double[])

I want to access some pixels in my Mat. Below is an example. How do I get similar effects in Java? I can not use function Mat.get(...) because returns double[]. Can anyone help? In C++ Mat saturation; float sat[256]; for(int i=0; i<256; i++) { …
user4406224
4
votes
1 answer

How to check MatOfKeyPoint in java?

How to check if a MatOfKeyPoints is empty or not? MatOfKeyPoint matOfKeyPoint = new MatOfKeyPoint(); What I need is something like if(matOfKeyPoint.size() != 1x0){ //.............................. } The Error is as below: Multiple…
Jürgen K.
  • 3,427
  • 9
  • 30
  • 66
4
votes
2 answers

Acces Matrix value without knowing the type opencv

I am writing a function in which I need to access to a element of a Mat, but this function can receive Mat of differents types. So, if I have: filtered.at(i) = (typeofmat) somevalue; It only occurs to me to do something like this…
Alejandro Alcalde
  • 5,990
  • 6
  • 39
  • 79
4
votes
1 answer

Access to the pixel value of a Mat using the JavaCV API

I have recently switched from the OpenCV C++ API to JavaCV and I'm trying to perform a basic operation, such as iterating over a Mat. I'm trying to access the pixel value of the Mat, but I can't seem to find a way, and the JavaCV project is short on…
INElutTabile
  • 866
  • 2
  • 20
  • 38
4
votes
1 answer

What is meant by header of a Mat object in OpenCV?

I am new to C++ programming and OpenCV. I was going through this tutorial on Mat class in OpenCV. It says "each Mat object has its own header" and uses the term header many times. I was not sure what does header mean in this context? I tried…
Ruchir
  • 845
  • 2
  • 10
  • 24