Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8680043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:08:37+00:00 2026-06-12T21:08:37+00:00

I am trying to do some computer video by reading the webcam stream in

  • 0

I am trying to do some computer video by reading the webcam stream in openCV. I’ve tried with both the internal webcam and an external usb webcam which both are working great with programs like camorama, streamer etc.

part of my code:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include "pic_manipulation.hpp"
#include "colorDetector.h"
#include <time.h>
using namespace std;


int main ( int argc, char **argv ){
    string file="../test.avi";
    cv::VideoCapture capture(0);//les video
    if(!capture.isOpened()){
        cout <<"could not read file"<<endl;
        return -1;
    }   
    double rate=capture.get(CV_CAP_PROP_FPS);
    bool stop(false);
    cv::Mat frame;
    cv::namedWindow("Extract frame");
    int delay=1000/rate;
    while(!stop){
        if(!capture.read(frame))break;
        cv::imshow("Extract frame", frame);
        sleep(delay/1000);
        if(cv::waitKey(delay)>=0){
            cout<<"stop"<<endl;
            stop=true;
            capture.release();
        }
        cout<< "one loop finished"<<endl;
    }
    return 0;
}    

When I compile and run the program I dont get any errors or warnings, it just returns at if(!capture.isOpened()) (Or if i skip the isOpened it returns at the next if(…)).
It reads video files with no problem at all. Anyone know if it is some bug with my install of opencv or if it is the linux webcam setting that’s causing the problem?
I am using linux mint and building the project with cmake/g++

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:08:38+00:00Added an answer on June 12, 2026 at 9:08 pm

    I resolved the problem by installing openCV following this excellent guide: A Comprehensive Guide to Installing and Configuring OpenCV 2.4.2 on Ubuntu

    I suspect that I didnt set the right configurations for building ffmpeg, v4l on a 64 bit platform as specified in the above guide. Anycase, it finally works!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to read file and split its line to get some context(Computer
I'm trying to come up with a way to make the computer do some
I have been developing some computer vision tools with openCV, but every time that
I am trying to add some security to my computer at home and would
I'm trying to test some geolocation codes on my computer, but I'm not even
I'm trying to install Pywinauto on my computer so that I can do some
I am trying to research and implement some computer vision techniques e.g. motion tracking
I'm trying to display Kinect's video stream into PictureBox. The reason is, I'd like
I'm trying to use some code that I wrote on another computer that splits
I'm trying to get some information filtered from this kind of page (http://www.ricardo.ch/kaufen/computer-und-netzwerk/apple/ipad/apple-ipad-16gb-3gwifi-neu-case-komplettes-zubehoer/v/an637769334/). I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.