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
5
votes
0 answers

Convert Mat image to Image

I am breaking my head over this: How do I convert a cv::Mat image to a System::Drawing::Image I know every image consists of bytes so you should probably use a byte array but right after that I'm lost. Can someone explain this to me?
AndriesN
  • 53
  • 6
5
votes
1 answer

Convert mat file to pandas dataframe

I want to convert this file to pandas dataframe. import pandas as pd import scipy.io mat = scipy.io.loadmat('cardio.mat') cardio_df = pd.DataFrame(mat) I get this error : Exception: Data must be 1-dimensional
5
votes
1 answer

Passing Mat to OpenCL Kernels causes Segmentation fault

I want to pass an OpenCL Mat to a selfwritten OpenCL Kernel for a FGPA (doesnt´t support the OpenCV OpenCL). Host- Code: Mat img = imread( "template.jpg", IMREAD_GRAYSCALE ); Mat output(img.rows, img.cols, CV_8UC1); // Program, Context already…
Drian
  • 171
  • 1
  • 10
5
votes
3 answers

C++ OpenCV Max storage capacity of cv::Mat

In my program I load some images, extract some features from them and use a cv::Mat to store these features. Based on the number of images I know the cv::Mat will be 700.000 x 256 in size (rows x cols) which is about 720Mb. But when I run my program…
DimChtz
  • 4,043
  • 2
  • 21
  • 39
5
votes
3 answers

Crop half of an image in OpenCV

How can I crop an image and only keep the bottom half of it? I tried: Mat cropped frame = frame(Rect(frame.cols/2, 0, frame.cols, frame.rows/2)); but it gives me an error. I also tried: double min, max; Point min_loc, max_loc; minMaxLoc(frame,…
shjnlee
  • 221
  • 2
  • 6
  • 20
5
votes
1 answer

How to initialize a cv::Mat using a vector of floats?

Is there a way of initializing a opencv cv::Mat using a vector object? Or do I need to loop over every entry of the vector and write it into the cv::Mat object?
mcExchange
  • 6,154
  • 12
  • 57
  • 103
5
votes
2 answers

How to dump Java objects came from JVM heap old generation?

Are there any tools to dump old generation of JVM heap? In other words, how can I tell if an object is came from young generation or old generation?
LeafiWan
  • 185
  • 1
  • 9
5
votes
1 answer

conversion between Mat and Mat1b/Mat3b

I want to match my code into a given interface. Inside my class OperateImage in all methods I use cv::Mat format. When putting it in SubMain function which uses cv::Mat3b and returns cv::Mat1b it does not work. How can I change it so that I can use…
beginh
  • 1,133
  • 3
  • 26
  • 36
5
votes
2 answers

How to give YUV data input to Opencv?

I am a beginner to Opencv. In my new opencv project I have to capture video frames from a camera device and need to give them to the opencv for processing, But now my camera is not working(hardware issue). And I need to test the opencv application…
Vineesh Vijayan
  • 313
  • 1
  • 5
  • 13
5
votes
1 answer

Getting ROI from a Circle/Point

I have two points in an image, centre left eye (X, Y) and centre right eye (X, Y). I have drawn circles around both eyes using cv::circle, and this is fine. But what I'm now trying to do is get the ROI of the circles I've drawn, i.e. extract the…
LKB
  • 1,020
  • 5
  • 22
  • 46
5
votes
1 answer

Issues in opening and reading .mat files in python

I have some important data (structured array) in Matlab with .mat extension which I want to open in python, I tried almost every blog from stack-overflow to access my data but still unsuccessful I need not just to load the data in python but to work…
Sibte Raza
  • 187
  • 1
  • 3
  • 7
5
votes
1 answer

Convert RGB array to Mat (OpenCv)

I've been trying to convert an array [R,G,B,..] in Mat object with opencv. But is returning wrong data, someone knows why? double data[12] = {0,0,255,0,0,255,0,0,255,0,0,255}; Mat src = Mat(2,2, CV_16UC3, data); and returns: M = [0, 0, 0, 0, 0,…
raphaelluchini
  • 87
  • 1
  • 1
  • 8
5
votes
2 answers

Issue converting unsigned char * image to OpenCV Mat

I have an issue parsing the image data from the frame grabber into an OpenCV Mat format. I can get image data from my EDT frame grabber as an unsigned char pointer and pass it to a newly created Mat, but I am losing valuable data in the process and…
user2640018
  • 51
  • 1
  • 1
  • 2
5
votes
1 answer

Error passing a cv::Mat to JNI using OpenCV on Android

I am developing an Android project with OpenCV and JNI. Actually I am changing the face-detection sample. The problem I have is that when I pass a cv::Mat reference it gives some strane output and it is not passed well. To put you in situation, I…
5
votes
2 answers

Calculation of coordinates of point on a scaled Mat image in OpenCv

If I have a Mat image object (OpenCV) whose size is 960*720, on which I have calculated the coordinates of a Point object, and then I scale this Mat image, and its new size is 640*480, how can I find the new coordinates of the Point?
user140888
  • 609
  • 1
  • 11
  • 31