mat

Using MATLAB API in C++, matOpen crashing program silently

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 19:27:27
问题 my problem is similar to this one but it is rather old and I cannot comment or upvote due to my (beginners) reputation. I am trying to compile the matcreat.cpp file from Matlab 2017b like this (using g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0): g++ -c -o matcreat.o -I"C:\Program Files\MATLAB\R2017b\extern\include" matcreat.cpp g++ -o matcreat.exe matcreat.o -L"C:\Program Files\MATLAB\R2017b\extern\lib\win64\mingw64" -llibmat -llibmex -llibmx -llibeng The program has a main

How to access a 3 dimensional Matrix elements?

爷,独闯天下 提交于 2021-01-28 11:49:05
问题 How do I index through a 3 dimensional matrix? I have this code and I know that the string inside cycles is wrong. Any suggestions on doing it in proper way. Mat frame_; cvtColor(frame, frame_, CV_BGR2HSV); int size[3] = { capture_box_dim*capture_box_count, capture_box_dim, 3}; Mat ROI = Mat::zeros (3, size, frame_.type()); for (int i = 0; i < capture_box_count; i++) { for (int j = i*capture_box_dim, int k = box_pos_y[i], int l = 0, int t = box_pos_x[i]; j < i*capture_box_dim + capture_box

OpenCV - How to push back Mat in a queue?

僤鯓⒐⒋嵵緔 提交于 2021-01-28 04:55:36
问题 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<Mat> frameSeq; int main() { Mat frame; VideoCapture video("path to video"); int key = 0; while (key != 'q') { video >> frame; frameSeq.push_back(frame); imshow("front", frameSeq.front()); imshow("back", frameSeq.back()); key = cvWaitKey(1); } return 0; } But when I resize the frame: deque<Mat> frameSeq; int main() { Mat frame;

Get a sub image using opencv Java

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 03:08:18
问题 I have already looked at how to get sub image by using OpenCV in java api, but this did not help I am curious how to create a sub image of a Mat image that I have loaded in from a file. When I run: crop = img.submat(405, 450, 280, 335); I get : OpenCV Error: Assertion failed (m.dims >= 2) in cv::Mat::Mat, file ..\..\..\..\opencv\modules\core\src\matrix.cpp, line 269 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\matrix

Get a sub image using opencv Java

时光总嘲笑我的痴心妄想 提交于 2021-01-28 01:08:46
问题 I have already looked at how to get sub image by using OpenCV in java api, but this did not help I am curious how to create a sub image of a Mat image that I have loaded in from a file. When I run: crop = img.submat(405, 450, 280, 335); I get : OpenCV Error: Assertion failed (m.dims >= 2) in cv::Mat::Mat, file ..\..\..\..\opencv\modules\core\src\matrix.cpp, line 269 Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\matrix

How to make a single 256*256*N (double) .mat from multiple .png image

点点圈 提交于 2020-08-10 19:35:07
问题 There are 100 PNG images,size=256*256,channel=1 Here is my test code(test for save 2 images in a mat): label = {sprintf('%01d.png\n', 0:100)}; img = regexp(label{:}(1:end-1), '\n', 'split'); F1=im2double(imread(img{1})); F2=im2double(imread(img{2})); label=cat(1,F1,F2);` save('test.mat', 'label') -> The test.mat is 256X256X2 double However,I want to save 100 images in the mat. My idea is F1~100 <=> 1~100.png then cat(1,F1,F2...F100),and save at last. So I try to use eval() in for loop create

Accessing data in SVHN dataset in python

让人想犯罪 __ 提交于 2020-07-10 17:09:56
问题 I tried to extract data from tar.gz file which contains digitStruct.mat file. I used the following code snippet: train_dataset = h5py.File('./train/digitStruct.mat') I want to access the bbox and name details from this object itself. for eg: train_dataset[0] Should output something like: {'boxes': [{'height': 219.0, 'label': 1.0, 'left': 246.0, 'top': 77.0, 'width': 81.0}, {'height': 219.0, 'label': 9.0, 'left': 323.0, 'top': 81.0, 'width': 96.0}], 'filename': '1.png'} I searched for it and