Ask Your Question
0

opencv cannot access my webcam

asked 2013-01-20 05:59:23 -0500

burakim gravatar image

Hi Everyone,

I have trouble with accesing webcam using opencv 2.4.3.

I googled almost everywhere but i can not solve my problem.


My System:

Hp Probook 4530s - HP Fixed HD Webcam

Ubuntu 12.10

OpenCV 2.4.3

İf I want to capture my built-in camera i get ERROR: capture is NULL

I'm using http://opencv.willowgarage.com/wiki/CameraCapture sample code.

I also tried with xawtv -hwscan using typing terminal. I get this output:

looking for available devices
port 129-144

type : Xvideo, image scaler
name : Intel(R) Textured Video`


/dev/video0: OK    
                 [ -device /dev/video0 ]
type : libv4l

name : HP HD Webcam [Fixed]

flags:  capture

then I can acces my webcam typing xawtv video0. I think I have no trouble with my webcam. I have trouble with opencv.

Please Help Me!

Because capturing webcam issue is important and urgent.

Any Help I will be appreciated

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
2

answered 2013-01-24 20:57:36 -0500

burakim gravatar image

Thanks for repling Alexander Smorkalov but i found solution. Actualy, I could not install properly,

I solved my problem few minutes ago. And I decided share my solution for people who handling similar error.

First I didnt install some of below packets ( I dont remember which of them, so I paste all of them)

libjpeg62-dev

libtiff4-dev

zlib1g-dev

libjasper-dev

libavcodec-dev

libdc1394-22-dev

libgstreamer0.10-dev

libgstreamer-plugins-base0.10-dev

libavformat-dev

libv4l-dev

libswscale-dev

Then You should configure your cmake process with this code

cmake -D CMAKE_BULD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON USE_V4L=ON WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON USE_GStreamer=ON .. Please notice USE_V4L=ON this code..

I hope you solve after reading my solution.

edit flag offensive delete link more

Comments

I did what you asked to do but it isn't accessing the camera still. It built fine but when running, it still showed a blank gray screen. I am using a lenevo thinkpad L420 and ubuntu 12.04

VedMathai gravatar imageVedMathai ( 2013-03-18 09:28:42 -0500 )edit
1

answered 2013-01-21 04:54:45 -0500

You can try OpenCV camera access with starter_video.cpp sample. It reads and shows frames from camera or video file.

Usage:

$cpp-examples-starter_video <camera index, i.e. 0> # for camera access
$cpp-examples-starter_video <path to video file> # for file reading

Also you can use it as reference of camera access in OpenCV. Saple on Willowgarage wiki is out of date. It uses old OpenCV 1.x C API. Use official documentation instead.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2013-01-20 05:59:23 -0500

Seen: 4,454 times

Last updated: Jan 24 '13