By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,227 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,227 IT Pros & Developers. It's quick & easy.

Reading data from webcam

P: n/a
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
Nov 14 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
aceto <ac*****@tin.it> scribbled the following:
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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'I' is the most beautiful word in the world."
- John Nordberg
Nov 14 '05 #2

P: n/a
yes, it has...
i can read the data in the same mode with win, dos, unix.

"Joona I Palaste" <pa*****@cc.helsinki.fi> ha scritto nel messaggio
news:bt**********@oravannahka.helsinki.fi...
aceto <ac*****@tin.it> scribbled the following:
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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'I' is the most beautiful word in the world."
- John Nordberg

Nov 14 '05 #3

P: n/a
ciro <ac*****@tin.it> scribbled the following:
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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I wish someone we knew would die so we could leave them flowers."
- A 6-year-old girl, upon seeing flowers in a cemetery
Nov 14 '05 #4

P: n/a

On Sun, 11 Jan 2004, ciro wrote:
Because it's annoying as hell.
Why not?
Rearranged. Please don't top-post.

"Joona I Palaste" <pa*****@cc.helsinki.fi> ha scritto nel messaggio
news:bt**********@oravannahka.helsinki.fi...
aceto <ac*****@tin.it> scribbled the following:
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.


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/writing...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

Nov 14 '05 #5

P: n/a
i'm really sorry
where can i search? i have no idea :(
tnx

"Joona I Palaste" <pa*****@cc.helsinki.fi> ha scritto nel messaggio
news:bt**********@oravannahka.helsinki.fi...
ciro <ac*****@tin.it> scribbled the following:
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.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I wish someone we knew would die so we could leave them flowers."
- A 6-year-old girl, upon seeing flowers in a cemetery

Nov 14 '05 #6

P: n/a
aceto wrote:
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;
}

--
Richard Heathfield : bi****@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #7

P: n/a
ciro wrote:
"Joona I Palaste" <pa*****@cc.helsinki.fi> ha scritto nel messaggio
aceto <ac*****@tin.it> scribbled the following:

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?


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


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.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #8

P: n/a
[ top posting and snippage failure repaired ]

ciro wrote:
"Joona I Palaste" <pa*****@cc.helsinki.fi> ha scritto nel
messaggio news:bt**********@oravannahka.helsinki.fi...
aceto <ac*****@tin.it> scribbled the following:
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.

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.
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c
Read my lips: The apple doesn't fall far from the tree.

Nov 14 '05 #9

P: n/a
ciro <ac*****@tin.it> spoke thus:
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.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Nov 14 '05 #10

P: n/a
nrk
Christopher Benson-Manica wrote:
ciro <ac*****@tin.it> spoke thus:


<snip OT question>

<snip on-topic redirection>

Your reply is very much on topic. No need to flag it as OT.

-nrk.
Nov 14 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.