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

cv::Mat to QImage and back

//Sorry for my english. Tell me please, what I am doing wrong? I have read a lot about this. And write some code, but I have a terrible result. As I understand in Opencv CV_8UC3 is the same as QImage::Format_RGB888 , except BRG and RGB…
user1113159
  • 645
  • 2
  • 7
  • 14
18
votes
2 answers

How to convert a heap dump in android to eclipse format

Im attempting to analyze a memory leak that has been driving me crazy for weeks, I found out about the eclipse MAT tool that helps you to figure out what is wrong, the problem is every single tutorial I have found says that I need to convert the…
Edmund Rojas
  • 6,376
  • 16
  • 61
  • 92
16
votes
5 answers

How can I get and set pixel values of an EmguCV Mat image?

I'm using the EmguCV 3.0.0 wrapper to the OpenCV 3.0 library. I'm using the Mat class in a few places. Here's an example of a single channel, 8x8 image made of double values: Mat image = new Mat(8, 8, DepthType.Cv64F, 1); The Image<> class…
kdbanman
  • 10,161
  • 10
  • 46
  • 78
16
votes
5 answers

C++ OpenCV image sending through socket

I'm trying to implement a streaming service using OpenCV and sockets. The server side loads a given image and sends it to the client, which receives it through the socket and displays it. I'm having a lot of trouble, though, sending the data of the…
user2938976
  • 235
  • 1
  • 3
  • 11
14
votes
2 answers

How to edit/read pixel values in OpenCv from Mat variable?

I am looking for an efficient way for editing/reading pixels from Mat (or Mat3b) variable. I have used :- Image.at(i,j) but it seems to be very slow. I also used this:- A.data[A.channels()*A.cols*i + j + 0] but the problem I am facing with…
Ravi Upadhyay
  • 314
  • 1
  • 3
  • 16
14
votes
3 answers

Initialize the values into Mat object in OpenCV

I need to initialize these array values directly into a Mat object. I tried using obj.put(i,j,data) but this does not work and the Mat object is still empty. i need this in java data [] = {103547.0, 2.0959531E7, 5.152769223E9, 1.415924406121E12,…
AciD IoN
  • 159
  • 1
  • 1
  • 10
14
votes
2 answers

How to access pixel values of CV_32F/CV_64F Mat?

I was working on homography and whenever I try to check the values of H matrix (type CV_64F) using H.at(i, j) I get random numbers(sometimes garbage value). I want to access pixel values of float matrix. Is there any way to do it? Mat A =…
Froyo
  • 17,947
  • 8
  • 45
  • 73
13
votes
3 answers

OpenCV cv::Mat set if

Is there a simple way to set all values in a cv::Mat to a given value if they fulfill some condition. For instance, I have CV_32FC1, and I want set all values which are 0 to 20. In MATLAB I would have simply done this: M(M == 0) = 20;
ahmadh
  • 1,582
  • 2
  • 18
  • 28
12
votes
2 answers

How to create empty Mat in OpenCV?

How to create empty Mat in OpenCV? After creation I want to use push_back method to push rows in Mat. Something like: Mat M(0,3,CV_32FC1); or only option is: Mat M; M.converTo(M,CV_32FC1); ?
mrgloom
  • 20,061
  • 36
  • 171
  • 301
11
votes
2 answers

What does Mat::checkVector do in OpenCV?

I tried to use the following function in OpenCV (C++) calcOpticalFlowPyrLK(prev_frame_gray, frame_gray, points[0], points[1], status, err, winSize, 3, termcrit, 0, 0.001); and I get this error OpenCV Error: Assertion failed ((npoints =…
rohit-biswas
  • 815
  • 1
  • 11
  • 23
11
votes
1 answer

How to get Mat with a drawable input in Android using OpenCV

I have some image files in the drawable folder. And now, I want to convert them into opencv Mat object. I've found a function: Mat img = Highgui.imread(inFile); which is reading a file path to get the Mat. However, I can't get path of my images as…
Season
  • 1,178
  • 2
  • 22
  • 42
11
votes
5 answers

load image with openCV Mat c++

I want to load an image using Mat in openCV My code is: Mat I = imread("C:/images/apple.jpg", 0); namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display. imshow( "Display window", I ); I am getting the following error…
vidzz
  • 197
  • 2
  • 4
  • 15
10
votes
2 answers

Print opencv matrix content in Java

I have openCV matrix in Java and I would like to print out the content of it.I tried the toString() function as follows descriptor.toString() so I could achieve this form "[[1,2,3,4],[4,5,6,7],[7,8,9,10]]" where each array is the ith row in the…
omarsafwany
  • 3,695
  • 8
  • 44
  • 75
10
votes
4 answers

Convert a string of bytes to cv::mat

I need to implement a function that receives a string containing the bytes of an image (received via boost socket connection) and converts the info into an OpenCV cv::Mat. I also know the width and height of the image and its size in bytes. My…
Mar de Romos
  • 719
  • 2
  • 9
  • 22
9
votes
10 answers

How to customize the color of specific mat badge?

I have two matbadges, I want one in red and one in yellow. For the one in red I'm using: = 0" matBadge="{{element.failedTests}}" matBadgeColor="warn"> For the other one, I can't find a yellow color from the default matBadgeColor values. How can I…
Haya D
  • 357
  • 2
  • 4
  • 16
1
2
3
62 63