mat

How to use the current date as name for a CSV file

限于喜欢 提交于 2019-12-11 10:19:34
问题 How do I create a csv file with date as the name of the csv file. I tried doing it, but the date won't appear only the name does. The language is Scilab which is similar to Matlab. 回答1: I do not understand your question fully. But following the csvWrite documentation and the date documentation. You could do someting like this filename_with_date_string = date() + ".csv"; directory_path = TMPDIR; // Some matrix you want to save M = [1:10] * 0.1; // Create the file file = fullfile(directory_path

LookUp Table for 16-Bit Mat Efficient way?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 10:16:44
问题 I want to reduce a 16-Bit Mat using opencv. I tried to use opencv LUT function to reduce this mat. But it seems like it wont support 16-Bit Mat. What is the efficient way of reducing a 16-Bit Mat using opencv c++? Any help is appreciated! e.g I want to scan & reduce all the pixels by 10 Grey levels! I want to implement the same example given in the opencv documentation for 16-Bit Mat. How to access each element of Mat through Pointers? 回答1: The source code of LUT is in this file: https:/

Convert vec3b into mat

强颜欢笑 提交于 2019-12-11 03:20:17
问题 I have color image in im , i want to get the pixel value of 3 channels image using vec3b using the following code for (int i = 0; i < im.rows; i++) { for (int j = 0; j < im.cols; j++) { for (int k = 0; k < nChannels; k++) { zay[k] = im.at<Vec3b>(i, j)[k]; //get the pixel value and assign to new vec3b variable zay } } } After that, i want to multiply the following mat 3x3 filter with that vec3b in zay Filter= (Mat_<double>(3, 3) << 0, 0, 0, 0, 1, 0, 0, 0, 0); How to convert vec3b into mat

How to process a JPEG binary data in OpenCV?

こ雲淡風輕ζ 提交于 2019-12-11 02:53:29
问题 I am trying to process a JPEG Binary data in OpenCV. When I do that I get Segmentation fault (core dumped) . I read JPEG file through fread command and stored in a buffer. After reading, I copied the buffer data to a Mat variable, When I tried to do grayscale conversion on copied data using cvtColor OpenCV function. I get Segmentation Fault. int main( int argc, char** argv ) { Mat threshold_output; Mat gray_image; unsigned char *pre_image; FILE *read_image; FILE *write_image; int filesize;

Hovering over Mat from opencv 3.4.1 in VS 15.7.5 still freezes

六眼飞鱼酱① 提交于 2019-12-10 20:12:47
问题 Is anybody else still getting freezes in VS 15.7.5 while hovering over the Mat keyword in openCV 3.4.1? (note: I have included openCV 3.4.1 and the contrib modules into VS using cmake.) Reference link to the same question but for an older version of Visual Studios: Link for old question. Apparently 15.7.4 was supposed to be a fix? Upvoted answer saying that the fix happened. Andrew's solution works for 15.7.5 too. Link for temp solution. Please take the time to give him credit. Screenshot for

How to print out a pixel value in a Mat image

旧时模样 提交于 2019-12-10 19:35:17
问题 I have a question about how to cout a pixel value in an image. For example: I have image and size is 10*10, I want to cout the pixel value at row 5 and column 5 in the image, here is what I code. Mat img; cout << img.at<uchar>(5,5) << endl; But the result is in the following image I'm wondering why it prints such strange symbol? Can anyone help me? Thanks a lot!!!! 回答1: You are printing char value. So the value will translate into ANSI representation of that value. If you want to see a number

Convert between OpenCV Mat and Leptonica Pix

一个人想着一个人 提交于 2019-12-10 10:34:37
问题 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. 回答1: I found found @ikarliga's answer worked for me because what I needed was to actually convert to the Mat format not necessarily use it with the Tesseract API which is what that OP was asking. Here are both the functions I use. The pix8ToMat function is taken from the node-dv project Pix *mat8ToPix(cv::Mat *mat8) { Pix *pixd = pixCreate(mat8->size()

Complex Matlab struct mat file read by python

不打扰是莪最后的温柔 提交于 2019-12-09 19:14:23
问题 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 Matlab struct when accessing in python?. But they both fail when it comes to more complex mat files. My anno_bbox.mat file structure is shown as follows: The first two level: In the size: In the hoi: In the hoi bboxhuman: When I use spio.loadmat('anno

Getting ROI from a Circle/Point

冷暖自知 提交于 2019-12-09 18:36:22
问题 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 eyes and save them in a new Mat. This is my current result: ...But as I said above, just need to work on extracting the circles around the eyes into a new Mat, one for each eye. This is my code: cv::Mat plotImage; plotImage = cv::imread("C:/temp/face

Merge several boost serialized OpenCV Mats

人走茶凉 提交于 2019-12-08 11:58:14
问题 Follow up the question here of Serializing OpenCV Mat_ My task is I have multiple OpenCV Mats that are serialized. Now I want to merge all those Mats. I can do this by deserialize these binaries into Mats and use push_back method to merge them. However, for my own reason, I have to merge them in binary format first before deserialize. How can I merge these binaries so that in the end, I can call my same deserialization to get the whole big Mat? Thanks 回答1: You can do this without using boost