473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Webcam init and get

Hi there,
I need a simple and stupid few line source code to access my webcam.
I found lots of huge projects (c++ c and other) which are so big that
they are impossible to be used.
Does somebody know how to manage a webcam from it's basic functions?
Where can i find a SIMPLE, VERY SIMPLE example project?
Doesn't matter the what is the OS or the language, i just need it is
easy portable source code...
Jun 27 '08 #1
5 2919
In article <6b**********************************@a1g2000hsb.g ooglegroups.com>,
frakie <fr*******@gmail.comwrote:
>I need a simple and stupid few line source code to access my webcam.
I found lots of huge projects (c++ c and other) which are so big that
they are impossible to be used.
Does somebody know how to manage a webcam from it's basic functions?
Where can i find a SIMPLE, VERY SIMPLE example project?
Doesn't matter the what is the OS or the language, i just need it is
easy portable source code...
You will not be able to find "easy portable source code", as
not all systems provide enough functionality to be able to control
webcams, or provide the functionality in very different ways.
For example on the system I am using right now, it is possible to
add a webcam... if you add in a digital I/O board, the webcam
for which uses a 75 pin connector and transfers data in parallel.
Meanwhile there are ethernet based webcams and USB based webcams
and probably serial and parallel based webcams as well, all of which
need to be controlled in very different ways.

The most common webcams these days are ethernet based or USB based.

The ethernet based ones are often accessible via TCP -- which requires
that the system you are working on has a TCP stack, which is by no
means guaranteed (though it is getting increasingly common except in
some kinds of embedded systems.) The access to such systems is via
an HTTP transaction; that does not require a full HTTP library, but
does require an HTTP framework, complete with some MIME parsing.
Typically to get an image, you would issue an HTTP GET against
a particular file on the system and it would return it in encoded
form. But controlling the camera would generally require HTTP POST
transactions.

The USB cameras... well, those require a USB interface library,
which is going to be operating system dependant.
You might find that someone has written Perl modules and posted
them at cpan.org and you might find that those modules work
for all of the kinds of systems you are interested in. But then
you face the problem that installing Perl itself can be a bear of
a job if you have to install it from source.
--
"Any sufficiently advanced bug is indistinguishable from a feature."
-- Rich Kulawiec
Jun 27 '08 #2
On May 12, 6:03 pm, rober...@ibd.nrc-cnrc.gc.ca (Walter Roberson)
wrote:
In article <6bc54fd5-4290-4442-a004-a5c8e40f0...@a1g2000hsb.googlegroups.com>,

frakie <frakie...@gmail.comwrote:
I need a simple and stupid few line source code to access my webcam.
I found lots of huge projects (c++ c and other) which are so big that
they are impossible to be used.
Does somebody know how to manage a webcam from it's basic functions?
Where can i find a SIMPLE, VERY SIMPLE example project?
Doesn't matter the what is the OS or the language, i just need it is
easy portable source code...

You will not be able to find "easy portable source code", as
not all systems provide enough functionality to be able to control
webcams, or provide the functionality in very different ways.
For example on the system I am using right now, it is possible to
add a webcam... if you add in a digital I/O board, the webcam
for which uses a 75 pin connector and transfers data in parallel.
Meanwhile there are ethernet based webcams and USB based webcams
and probably serial and parallel based webcams as well, all of which
need to be controlled in very different ways.

The most common webcams these days are ethernet based or USB based.

The ethernet based ones are often accessible via TCP -- which requires
that the system you are working on has a TCP stack, which is by no
means guaranteed (though it is getting increasingly common except in
some kinds of embedded systems.) The access to such systems is via
an HTTP transaction; that does not require a full HTTP library, but
does require an HTTP framework, complete with some MIME parsing.
Typically to get an image, you would issue an HTTP GET against
a particular file on the system and it would return it in encoded
form. But controlling the camera would generally require HTTP POST
transactions.

The USB cameras... well, those require a USB interface library,
which is going to be operating system dependant.

You might find that someone has written Perl modules and posted
them at cpan.org and you might find that those modules work
for all of the kinds of systems you are interested in. But then
you face the problem that installing Perl itself can be a bear of
a job if you have to install it from source.
--
"Any sufficiently advanced bug is indistinguishable from a feature."
-- Rich Kulawiec
Thank you very very much Walter!
I know there must be an interface to interact with, but everything I
found is really too confusing since each project is adding more
functions than just init and getImage...
I will try cpan.org Perl module, and I'll tell you! Really thanks!
Jun 27 '08 #3
frakie *<frakie...@gmail.comwrote:
>I need a simple and stupid few line source code to access my webcam.
>I found lots of huge projects (c++ c and other) which are so big that
>they are impossible to be used.
>Does somebody know how to manage a webcam from it's basic functions?
>Where can i find a SIMPLE, VERY SIMPLE example project?
>Doesn't matter the what is the OS or the language, i just need it is
>easy portable source code...
You might also want to look at Gstreamer. While the framework is
portable, I don't know about webcam support for operating systems
other than Linux (v4l2src worked great for me in some project).
The big advantage is that changing from reading webcam stream to
reading video file is just a few lines (and this can be very useful in
testing!).

Domen
Jun 27 '08 #4
On 2008-05-12, frakie <fr*******@gmail.comwrote:
Hi there,
I need a simple and stupid few line source code to access my webcam.
I found lots of huge projects (c++ c and other) which are so big that
they are impossible to be used.
Does somebody know how to manage a webcam from it's basic functions?
Where can i find a SIMPLE, VERY SIMPLE example project?
Doesn't matter the what is the OS or the language, i just need it is
easy portable source code...
You could consider using libavdevice from ffmpeg, video4linux and
video4windows should be supported, it is plain and portable C (but not
trivial to use, but that's the price you have to pay to deal with
multimedia).

Regards.
--
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
Jun 27 '08 #5
In article <sl*****************************@geppetto.reilabs. com>,
Stefano Sabatini <st**************@santefisi.caos.org.invalidwrot e:
>On 2008-05-12, frakie <fr*******@gmail.comwrote:
>I need a simple and stupid few line source code to access my webcam.
>You could consider using libavdevice from ffmpeg, video4linux and
video4windows should be supported, it is plain and portable C (but not
trivial to use, but that's the price you have to pay to deal with
multimedia).
http://cekirdek.pardus.org.tr/~ismai...8c-source.html

#include "config.h"
#include "libavformat/avformat.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <asm/types.h>
#include <linux/videodev2.h>
#include <time.h>
That's not portable C !

C89 3.8.2 Source File Inclusion
[...]
There shall be an implementation-defined mapping between the
delimited sequence and the external source file name. The
implementation shall provide unique mappings for sequences
consisting of one or more letters (as defined in 2.2.1) followed
by a period (.) and a single letter. The implementation may ignore
distinctions of alphabetical case and restrict the mapping
to six significant characters before the period.
Now "libavformat/avformat.h" has more than six significant characters
before the period, so which, if any, file that will map to is
implementation-defined -- and thus not portable C.
--
"I like to build things, I like to do things. I am having
a lot of fun." -- Walter Chrysler
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kelowna | last post by:
Yes... Its a server os... i kno! i hav xp yea but tis system is for screwing with.. Im sure theres alot of ppl here tat kno tis stuff inside-out! im doing this for educational purposes so dont give...
4
by: Joakim Rylander | last post by:
Hi all, I need to create a public booth where people can look at themselves in a webcam and snap a picture which will be seen on a webpage. The backend is easy, it's the webcam part that I have...
0
by: Elp | last post by:
Hi, We have developped an client application in C#. Among other things, this application should display in 4 different windows (or 4 different panels in the same window), 4 webcam streams (web...
4
by: Mathieu Chavoutier | last post by:
Hi. Is it possible to do a program that show the "film" that is currently on our webcam ? I do not have a Webcam for the moment, so, if you have advices to chose a Webcam compliant (with what...
0
by: Steve | last post by:
Hi Can anyone please tell me how to use a webcam on a form. I have done an app that uses a webcam, but I have used the drivers for that webcam. Now I need to use a different camera on a...
10
by: aceto | last post by:
Hi. I'm sorry for my bad english, but it's not my motherlanguage. I need to read data from a webcam and display the images on DOS . So, how can i show this images? i have to translate the data...
3
by: DillonCzerny | last post by:
Hello Many times I see a lot of people post webcam videos on google video or youtube. I wonder how do they record it from those people’s webcam? I have a fake webcam and I want to record some...
2
by: =?Utf-8?B?d29vZHliZWFy?= | last post by:
I just bought a new Dell, so I'm sorry if this is a stupid question. There is a built-in webcam. Im using the disc provided by Dell (Dell Webcam Software), however during the installation, a...
13
by: Berco Beute | last post by:
I've been trying to access my webcam using Python, but I failed miserably. The camera works fine under Ubuntu (using camora and skype), but I am unable to get WebCamSpy or libfg to access my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.