Ask Your Question

potatoprogrammer's profile - activity

2018-04-11 01:47:28 -0500 received badge  Notable Question (source)
2017-05-15 04:40:24 -0500 received badge  Popular Question (source)
2015-09-07 02:54:28 -0500 received badge  Student (source)
2014-09-21 19:04:39 -0500 asked a question VideoIO Error: Pixel format unsupported?

I have a logitech usb camera attached to my computer running Ubuntu 14.04 LTS, but when I tried to use the camera to display a video feed, I got the following output:

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV VIDIOC_G_FMT: Bad file descriptor VIDIOC_G_FMT: Bad file descriptor VIDIOC_STREAMON: Inappropriate ictl for device Frame size: -1 x -1 Cannot read a frame from video stream Unable to stop the stream.: Inappropriate ioctl for device

It worked on my other computer. Anyone know what's wrong? Code below:

#include "opencv2/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char* argv[])
{
    VideoCapture cap(0); // open the video camera no. 0

    if (!cap.isOpened())  // if not success, exit program
    {
        cout << "Cannot open the video cam" << endl;
        return -1;
    }

    double dWidth = cap.get(CAP_PROP_FRAME_WIDTH); //get the width of frames of the video
    double dHeight = cap.get(CAP_PROP_FRAME_HEIGHT); //get the height of frames of the video

    cout << "Frame size : " << dWidth << " x " << dHeight << endl;

    namedWindow("Camera Video",WINDOW_AUTOSIZE); //create a window called "MyVideo"

    while (1)
    {
        Mat frame;

        bool bSuccess = cap.read(frame); // read a new frame from video

        if (!bSuccess) //if not success, break loop
        {
            cout << "Cannot read a frame from video stream" << endl;
            break;
        }

        imshow("MyVideo", frame); //show the frame in "MyVideo" window
        char c = waitKey(30);
        if (c == 27) //wait for 'esc' key press for 30ms. If 'esc' key is pressed, break loop
        {
            cout << "esc key is pressed by user" << endl;
            break; 
        } 
    }
    return 0;
}
2014-09-08 10:32:43 -0500 commented question Error: No such file or directory?

Oh wow, I feel silly now, lol. Thanks.

2014-09-08 02:05:45 -0500 asked a question Error: No such file or directory?

Newbie question here. I'm new to Linux and OpenCV/CMake, and I've just succesfully followed the steps in http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html to install OpenCV on Linux.

However, when I tried to run the sample program in the next tutorial (http://docs.opencv.org/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html#linux-gcc-usage), running "cmake ." in my project directory seems to work as it should, but when I try "make" afterwards, I get the error: "c++: error: $/usr/local/include: No such file or directory"

My DisplayImage.cpp file is identical to the one on the website, and my CMakeLists.txt looks like below:

cmake_minimum_required(VERSION 2.8)
project(DisplayImage)
find_package(OpenCV REQUIRED)
add_executable(DisplayImage DisplayImage.cpp)
target_link_libraries(DisplayImage "$/usr/local/include")

Can anyone help me with this?

2014-09-08 01:51:59 -0500 commented answer After installing OpenCV 2.9.0.0, I can't compile any program, g++ gives errors (e.g g++: error: pthread: No such file or directory). Please help!

Just for clarification, for the field "${OpenCV_LIBS}", would I put in the path to where I have the opencv library installed (ex. /usr/local/include)?