Ask Your Question

M. Tony's profile - activity

2016-06-28 07:36:24 -0600 received badge  Student (source)
2016-06-20 14:07:28 -0600 received badge  Editor (source)
2016-06-20 14:06:51 -0600 asked a question Writing a Video with OpenCV on Ubuntu

I'm trying to save a displayed video from my camera with OpenCV, but none of the codes I use are working. I'm using Ubuntu 14.04 and Qt as my IDE. What could you guys recommend me? The camera is Zed from stereolabs. I'm using the code they provided in their webpage, which produce a window with the camera stream. I just want to save that video. This is the code:

#include <iostream>;

// OpenCV
#include <opencv2/core/core.hpp>;
#include <opencv2/highgui/highgui.hpp>;
#include <opencv2/imgproc/imgproc.hpp>;

// ZED
#include <zed/Camera.hpp>;

// Input from keyboard
char keyboard = ' ';

int main(int argc, char** argv)
// Initialize ZED color stream in HD and depth in Performance mode
sl::zed::Camera* zed = new sl::zed::Camera(sl::zed::HD1080);
sl::zed::ERRCODE err = zed->init(sl::zed::MODE::PERFORMANCE, 0, true);

// Quit if an error occurred
if (err != sl::zed::SUCCESS) {
std::cout << "Unable to init the ZED:" << errcode2str(err) << std::endl;
delete zed;
return 1;

// Initialize color image and depth
int width = zed->getImageSize().width;
int height = zed->getImageSize().height;
cv::Mat image(height, width, CV_8UC4,1);
cv::Mat depth(height, width, CV_8UC4,1);

// Create OpenCV windows
cv::namedWindow("Image", cv::WINDOW_AUTOSIZE);
cv::namedWindow("Depth", cv::WINDOW_AUTOSIZE);

// Settings for windows
cv::Size displaySize(720, 404);
cv::Mat imageDisplay(displaySize, CV_8UC4);
cv::Mat depthDisplay(displaySize, CV_8UC4);

// Loop until 'q' is pressed
while (keyboard != 'q') {

 // Grab frame and compute depth in FULL sensing mode
 if (!zed->grab(sl::zed::SENSING_MODE::FULL))

 // Retrieve left color image
 sl::zed::Mat left = zed->retrieveImage(sl::zed::SIDE::LEFT);

// Retrieve depth map
 sl::zed::Mat depthmap = zed->normalizeMeasure(sl::zed::MEASURE::DEPTH);

 // Display image in OpenCV window
 cv::resize(image, imageDisplay, displaySize);
 cv::imshow("Image", imageDisplay);

 // Display depth map in OpenCV window
 cv::resize(depth, depthDisplay, displaySize);
 cv::imshow("Depth", depthDisplay);

keyboard = cv::waitKey(30);


delete zed;


Any suggestion will be appreciated! Thanks in advance.

2016-06-11 22:27:44 -0600 commented question C++ IDE for Ubuntu compatible with OpenCV

Sounds great, I will give it a try, thanks for the answers!

2016-06-10 18:36:45 -0600 asked a question C++ IDE for Ubuntu compatible with OpenCV


I'm looking for an C++ IDE that is compatible with OpenCV. I was using Visual Studios in Windows and it was perfect, but know I'm limited to Ubuntu. What can you guys recommend me? I've seen a few like code::blocks and eclipse, but I'm not sure if they are going to work well like visual studios.

Any suggestion will be appreciated, Thanks!

2016-06-07 16:26:01 -0600 asked a question Object Tracking with Mouse event

I have a project where I have to track a desired object by creating a user interface. The idea is basically that I will have a window showing the video stream and with the mouse I can click the object and track it. I've been reading and I think that a way to accomplish this would be by using the mouse clicking event function from OpenCV. Maybe I can start with something simple like clicking and verify certain color to track. I great example would be this video: Something like this is also acceptable. What could you guys suggest me?

I'm using Visual Studio and OpenCV. My experience in programming is not much, so this is a pretty challenging project for me. The more detailed the answer and suggestions, the better. Suggestions will be really appreciated