Reading data from webcam

A

aceto

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 received to a bitmap, to display it on the
screen in DOS, mut i don't know how to do....can u give me some help or
piece of advices?
Thank you very much!
Mark
 
J

Joona I Palaste

aceto said:
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 received to a bitmap, to display it on the
screen in DOS, mut i don't know how to do....can u give me some help or
piece of advices?
Thank you very much!
Mark

This has nothing to do with C. Ask in an MS-DOS newsgroup, please.
 
A

Arthur J. O'Dwyer

On Sun, 11 Jan 2004, ciro wrote:


Because it's annoying as hell.
Why not?
Rearranged. Please don't top-post.

yes, it has...
i can read the data in the same mode with win, dos, unix.

By the way, Joona, weren't we going to handle this sort of
OT request with Ben Pfaff's "topicality guidance" message? For
the benefit of 'aceto', or 'ciro', or whoever the OP is, Ben
has put it on the Web here:
http://www.msu.edu/~pfaffben/writings/clc/off-topic.html

Finally, some clarification for the OP. Your program will
almost certainly follow this rough algorithm:

1. Get the data from the webcam.
2. Make that raw data into an array of pixels.
3. Display those pixels on the screen.
4. Go back to step 1.

Here in comp.lang.c, we can help you with steps 2 and 4, because
they can be done in pure portable C. We cannot help you with
steps 1 or 3, not only because you haven't given us sufficient
information about your platform, but because even if you had,
you couldn't do them in C anyway. You'll need some sort of
third-party library code, most likely. Ask in a newsgroup
dedicated to webcam programming, or whatever OS or compiler you're
using. [Use Google to find one.]

HTH,
-Arthur
 
J

Joona I Palaste

ciro said:
yes, it has...
i can read the data in the same mode with win, dos, unix.

You are using a system-specific extension to read the data, not the C
programming language. Programming languages usually do not define
system-specific extensions.
 
R

Richard Heathfield

aceto said:
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 received to a bitmap, to display it on the
screen in DOS, mut i don't know how to do....can u give me some help or
piece of advices?
Thank you very much!

Let's assume you've managed to trick the filesystem into thinking the webcam
is a file, perhaps with the name "/dev/webcam". Then you can display a
bitmap as follows:

#include <stdio.h>
#include <limits.h>

#define SCRWIDTH 72 /* adjust to taste */

int main(void)
{
FILE *fp = fopen("/dev/webcam", "rb");
if(fp != NULL)
{
int count = 0;
int ch;
int i;
while((ch = getc(fp)) != EOF)
{
++count;
putchar(' '); /* optional - included for clarity */
for(i = 1 << (CHAR_BIT - 1); i > 0; i /= 2)
{
++count;
putchar((ch & i) ? '0' : '1');
}
if(count >= SCRWIDTH)
{
count = 0;
putchar('\n');
}
}
putchar('\n');
fclose(fp);
}
return 0;
}
 
C

CBFalconer

ciro said:
yes, it has...
i can read the data in the same mode with win, dos, unix.

No it doesn't. The standard C language knows nothing about
screens, webcams, images, bitmaps, DOS. Look for a newsgroup
dealing with your particular system.

Also, don't toppost, and don't change your name between postings.
Your answer belongs after (or intermixed with) the properly
snipped quoted material.
 
M

Morris Dovey

[ top posting and snippage failure repaired ]
yes, it has... i can read the data in the same mode with win,
dos, unix.

No, Joona was absolutely correct. Standard C knows nothing of
webcams, webcan interfaces, image formats and/or transmission,
screens, or pixel-writing.

The redirection to an MS-DOS forum was completely correct.

Top-posting is considered bad manners in comp.lang.c; and failure
to trim appropriately is considered an indication of clueless
behavior.
 
C

Christopher Benson-Manica

ciro said:
i'm really sorry
where can i search? i have no idea :(

The below text has some suggestions. If that isn't as helpful as you
need, try Google.

(The below text was originally written by Ben Pfaff)

For your convenience, the list below contains topics that are not
on-topic for comp.lang.c, and suggests newsgroups for you to explore
if you have questions about these topics. Please do observe proper
netiquette before posting to any of these newsgroups. In particular,
you should read the group's charter and FAQ, if any (FAQs are
available from www.faqs.org and other sources). If those fail to
answer your question then you should browse through at least two weeks
of recent articles to make sure that your question has not already
been answered.

* OS-specific questions, such as how to clear the screen,
access the network, list the files in a directory, or read
"piped" output from a subprocess. These questions should be
directed to OS-specific newsgroups, such as
comp.os.ms-windows.programmer.misc, comp.unix.programmer, or
comp.os.linux.development.apps.

* Compiler-specific questions, such as installation issues and
locations of header files. Ask about these in
compiler-specific newsgroups, such as gnu.gcc.help or
comp.os.ms-windows.programmer.misc. Questions about writing
compilers are appropriate in comp.compilers.

* Processor-specific questions, such as questions about
assembly and machine code. x86 questions are appropriate in
comp.lang.asm.x86, embedded system processor questions may
be appropriate in comp.arch.embedded.

* ABI-specific questions, such as how to interface assembly
code to C. These questions are both processor- and
OS-specific and should typically be asked in OS-specific
newsgroups.

* Algorithms, except questions about C implementations of
algorithms. "How do I implement algorithm X in C?" is not a
question about a C implementation of an algorithm, it is a
request for source code. Newsgroups comp.programming and
comp.theory may be appropriate.

* Making C interoperate with other languages. C has no
facilities for such interoperation. These questions should
be directed to system- or compiler-specific newsgroups. C++
has features for interoperating with C, so consider
comp.lang.c++ for such questions.

* The C standard, as opposed to standard C. Questions about
the C standard are best asked in comp.std.c.

* C++. Please do not post or cross-post questions about C++
to comp.lang.c. Ask C++ questions in C++ newsgroups, such
as comp.lang.c++ or comp.lang.c++.moderated.

* Test posts. Please test in a newsgroup meant for testing,
such as alt.test.

news.groups.questions is a good place to ask about the appropriate
newsgroup for a given topic.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,135
Messages
2,570,783
Members
47,341
Latest member
hanifree

Latest Threads

Top