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

Get value in enter keypress event in angular material

Trying to create an input with a clear button following the example from Angular Material, link to the example, what I want is to get the input value on a keypress enter event. HTML:
ketimaBU
  • 901
  • 4
  • 15
  • 35
9
votes
1 answer

OpenCv create 3 channel Mat from continuous data array

I'd like to create an OpenCV 3-channel Mat using data allocated elsewhere where the pixels of each channel are together, unlike the data for an OpenCV Mat where the data from different channels is interleaved. Mat outputMat = Mat(dimY, dimX,…
locke14
  • 1,335
  • 3
  • 15
  • 36
9
votes
1 answer

Read (SVHN) Dataset in python

I would like to read using python the following dataset: http://ufldl.stanford.edu/housenumbers/train_32x32.mat I had loaded this mat file using io.loadmat('train_32x32.mat') but when I am trying to show an images from the above numpy array, I do…
user3698971
  • 297
  • 1
  • 3
  • 12
8
votes
4 answers

Filter OpenCV Mat for NAN values

Is there a direct way to create a mask where values in a cv::Mat_ are compared against NAN? cv::Mat_ mat = ... cv::Mat_ mask = (mat == NAN); does not work because f == NAN is always false, even if f was assigned NAN. And there…
tmlen
  • 8,533
  • 5
  • 31
  • 84
8
votes
2 answers

Right way to compute cosine similarity between two arrays?

I am working on a project that detects some features of two input images(handwritten signatures) and compares those two features using cosine similarity. Here When I mean two input images, one is an original image, and other is duplicate image. Say…
Shruthi Kodi
  • 107
  • 1
  • 3
  • 10
8
votes
3 answers

how to modify values of Mat according to some condition in opencv?

In Matlab a(a>50)=0 can replace all elements of a that are greater than 50 to 0. I want to do same thing with Mat in OpenCV. How to do it?
sam ran
  • 137
  • 1
  • 1
  • 7
8
votes
4 answers

cv::Mat's release method

I would like to confirm whether cv::Mat::release() method is similar to free() in C programming, i.e., its deallocates the Matrix data from the memory. In particular, I would like to understand the behaviour of this method with respect to memory…
Bryanyan
  • 677
  • 3
  • 13
  • 30
8
votes
1 answer

UnsatisfiedLinkError: n_Mat while using opencv2.4.3 with android 4.0

i am using opencv in android. but when i am adding Mat() in my code my application unexpectedly stops after launch. my error log is as below: FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError: n_Mat at org.opencv.core.Mat.n_Mat(Native Method) at…
AnShU
  • 239
  • 1
  • 4
  • 11
7
votes
1 answer

How is the comma-separated initializer of OpenCV Mat implemented with C++?

#include #include using namespace std; using namespace cv; int main() { Mat a = (Mat_(3, 3) << 0, 1, 2, 3, 4, 5, 6, 7, 8); cout << a << endl; return 0; } How is the comma-separated initializer…
chaosink
  • 1,329
  • 13
  • 27
7
votes
1 answer

Multi-channel matrix/array

I've been reading about openCV recently and its cv::Mat data structure. In the documentation, the author keeps mentioning about multi-channel array and multi-channel matrix. Can some one give me a definition of those two, and what is a "channel"? I…
hphp95
  • 305
  • 3
  • 13
7
votes
4 answers

Display OpenCV Mat with JavaFX

I would like to display Mat objects from OpenCV directly with JavaFX. I have seen that it is possible to convert a Mat object into a BufferedImage. But as far as I know you can't display a BufferedImage with JavaFX, so another conversion would have…
TomTom
  • 2,820
  • 4
  • 28
  • 46
7
votes
1 answer

Get frame from video with libvlc smem and convert it to opencv Mat. (c++)

[UPDATED WITH PARTIAL ANSWER] Here is my code: void cbVideoPrerender(void *p_video_data, uint8_t **pp_pixel_buffer, int size) { // Locking imageMutex.lock(); videoBuffer = (uint8_t *)malloc(size); *pp_pixel_buffer = videoBuffer; } …
grll
  • 1,047
  • 2
  • 10
  • 18
7
votes
1 answer

opencv single h264 raw frame as a binary string

have created a rtsp client in python that receives a h264 stream and returns single h264 raw frames as a binary strings. I am trying to process each h264 frames on-the-fly. I have unsuccessfully tried several ways to convert this frame into a numpy…
user3202342
  • 79
  • 1
  • 2
6
votes
1 answer

Mat to Bitmap in Android jni cpp file

I am doing native development with android. I can't use OpenCV in java. I will give Bitmap as input to jni. I found a way to convert Bitmap-> Mat. Then I can process() Mat image type. Now I need to re-convert the processed Mat->Bitmap and send it to…
6
votes
2 answers

creating Mat with OpenCV in python

I am used to Java's implementation of OpenCV. I want to create a Mat structure, fill data into it, extract a submat and then apply some image transform. In Java, I use: my_mat = new Mat(my_rows, my_cols, CvType.CV_8U); my_mat.put(0, 0,…
epsilones
  • 11,279
  • 21
  • 61
  • 85
1 2
3
62 63