Easy Webcam - uses dll

New to FreeBASIC? Post your questions here.
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Post by opicard »

One more question (not a discussion...):

Sometime I'looking forward to loading a jpeg image in place of the video image.

Is Bload suitable ? Have you got a sample which fits with the code you gave me?

- Loading a jpeg image
- ... my stuff with it
- printing some lines on it
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Post by opicard »

And:

About Screenres, 800,480,32

how could i locate the cursor in the area 641-800 to print some data results or input some params?
BasicCoder2
Posts: 3954
Joined: Jan 01, 2009 7:03
Location: Australia

Post by BasicCoder2 »

opicard wrote: One more question (not a discussion...):

Sometime I'looking forward to loading a jpeg image in place of the video image.

Is Bload suitable ? Have you got a sample which fits with the code you gave me?

- Loading a jpeg image
- ... my stuff with it
- printing some lines on it

And:

About Screenres, 800,480,32

how could i locate the cursor in the area 641-800 to print some data results or input some params?
I only use bitmaps or arrays to save images so I have
to load an image of any other format into MSPaint and
save it as a bitmap.

You might use the Search option of these forums to
locate information about using other formats.

If you want a more robust way of handling images you
might use an image TYPE to hold its dimensions, its
depth, its format and so on.

You can use the LOCATE statement to set the cursor
at some position. Each character is 8x8 pixels.

You can move the image to the right of the window.

eg. Put (160,0), lpImage,Pset

Now you can print on the left side of the window.


Code: Select all


ScreenRes 800,480,32

Dim As Any Ptr lpImage=ImageCreate(640,480)

BLOAD "c:/FreeBasic/bitmaps/boat2.bmp", lpImage

Put (0,0), lpImage,Pset


locate 1,81
print "Hello I am here"

sleep
end


opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Post by opicard »

Well You'r right I'm a bit lazy but I often miss samples to understand the use of FB keywords.

Anyway thanks once more, since You gave me all the tools I was looking for:

- Get an image from web cam
- Get an image from file
- Save it
- print It on screen
- draw on screen as I like
- manage pixels
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Post by opicard »

I got one question left:

In my former organisation I was using à Python Lib wich allowed me to have those functions very usefull for enhancing the camera:


cam = Device()
cam.setResolution(640,480)
cam.displayCaptureFilterProperties()
cam.displayCapturePinProperties()


Is there something similar for FB?
BasicCoder2
Posts: 3954
Joined: Jan 01, 2009 7:03
Location: Australia

Post by BasicCoder2 »

opicard wrote:I got one question left:

In my former organisation I was using à Python Lib wich allowed me to have those functions very usefull for enhancing the camera:


cam = Device()
cam.setResolution(640,480)
cam.displayCaptureFilterProperties()
cam.displayCapturePinProperties()


Is there something similar for FB?
Any limits are set by the escapi.dll being used or by escapi.bi

The resolution is being set with this piece of code.

Dim Shared As SimpleCapParams Params
With Params
.mWidth = iWIDTH
.mHeight = iHEIGHT
.mTargetBuf=cptr(Integer Ptr,lpImage)
.mTargetBuf+=8
End With

Somehow you can get the device number and capture up
to four devices using the escapi.dll.

I had it working for C++ and FreeBasic but lost it
all last year along with all my image processing
functions and have only recently been using some of
my spare time to rewrite all the code again. I know,
you must back everything up but I didn't!!!

D.J.Peters (Joshy) who wrote the escapi.bi and the
FreeBasic example code is the genius on all this. If
you are able to get a response from him he will be
better able to answer your questions.

May I ask if you are writing commercial software
or just programming out of personal interest?


John
opicard
Posts: 81
Joined: Feb 26, 2008 16:40

Post by opicard »

Well I'm programming now mostly for my own interest . I wanted for a long time to manage pixels because I think there's a lot of project around this.

No doubt there's commercial interest in prospect, but I'm far from it...

With your help, I'm about to reach one step: Have an animation tool, Its top funny...

------

So,

I got those 2 questions left:

- my former post (ehancing cam device, ...)
- a light way to manage jpeg files versus bmp file (the topics i red about arn't easy for me).

I don't kow how have responses from DJ Peters about ...
baddzs
Posts: 22
Joined: Jul 28, 2006 14:18

Post by baddzs »

hi all!
I have a fujitsu-siemens 130 portable webcam.
I would like to use at maximum resolution.
I tried the escapi.bi but it only worked with 320x240 hardware resolution, i changed the res to other, but the image only was stretched.
In other software (webcamxp) the cam works nice at higher res...

I tried the fbvideoclass.bas, but i get errors: "Can't connect the video device [1] The equipment should be attached and switched on." or beep and nothing or full black screen.
How can i use it?
Thanks!
D.J.Peters
Posts: 8631
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

baddzs wrote:I tried the fbvideoclass.bas, but i get errors: "Can't connect the video device [1] The equipment should be attached and switched on." or beep and nothing or full black screen.
How can i use it?
Thanks!
if your device isn't detected as Video for Windows device
the right WDM win drivers must be installed.

try "test06.bas" and select an RGB format first (not an encoder)

Joshy
baddzs
Posts: 22
Joined: Jul 28, 2006 14:18

Post by baddzs »

D.J.Peters wrote:
baddzs wrote:I tried the fbvideoclass.bas, but i get errors: "Can't connect the video device [1] The equipment should be attached and switched on." or beep and nothing or full black screen.
How can i use it?
Thanks!
if your device isn't detected as Video for Windows device
the right WDM win drivers must be installed.

try "test06.bas" and select an RGB format first (not an encoder)

Joshy
test06:
no dialog, a empty console and an other black window

test03:
Can't connect the device...

test04:
clear console window for a moment and end

test05:
beep and black console window

test01:
Can' connect the device....

test02:
black console window


In Windows the webcam is a "USB Video Device"
In device manager: Unknown -> USB Video device

Webcam xp can connect to webcam:

a, as" DirectX source" -> "USB video device" and the cam works 1280*1024 hardware res. if i change the settings in "pin".

b, as "video for windows source" ->" microsoft wdm image capture (win32)"
at source sittings i can set max 640*480 and only YUY2 (not YUV2)
when i use this mode the hdd continues works a little and flashing the sand-glass cursore. . .


What is the problem? How can i reisntall or update the wdm driver?
Thanks!
D.J.Peters
Posts: 8631
Joined: May 28, 2005 3:28
Contact:

Post by D.J.Peters »

can be it's a plug and play device with DirectX VideoShow only

but you can test your device with this short tools too.

this will use any connect cam with VFW
http://www.netcamera.de/download/vidcap.zip

this will use any connected cam with WDM
http://www.netcamera.de/download/amcap.zip

Joshy
baddzs
Posts: 22
Joined: Jul 28, 2006 14:18

Post by baddzs »

D.J.Peters wrote:can be it's a plug and play device with DirectX VideoShow only

but you can test your device with this short tools too.

this will use any connect cam with VFW
http://www.netcamera.de/download/vidcap.zip

this will use any connected cam with WDM
http://www.netcamera.de/download/amcap.zip

Joshy

I tested escapi and fbvdeoclass test files again on an other PC, with the same webcam.
The resoults is better:
Some testxx.bas files work, but the colors aren"t correct. And the max res is 640x480.
Escapi colors are ok, but the max hardware res: 320x240
I can't understand....

vidcap max res: 640x480

amcap is good, can use the cam at max hardware res.
How can i use the cam in FB with same mode?

Thank you D.J.Peters!
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

cam

Post by TESLACOIL »

I got a Logitech web cam pro9000

http://www.youtube.com/watch?v=DaoGEyLtTFM

pretty awesome pic quality & does well in low light

auto focus works as close as 3 inches so u can use it as a magnifying glass

(auto focus AI is for faces and background bias, so is a little slow on zooming in. wants to move out (you can see the focus slider in moving realtime)


the mic is good , speech recognition still works from 10ft +away

mic downsides, i think it has spike suppression & auto volume adjust.....whatever !?....its very easy to tip the mic into crackle n pop mode

has manual override for everything

A+

webcam has a button on the side, press to take a snapshot (could be done with a servo for robotics applications)

--------------------------------------------------------------------------

I also dload Camstudio2-0.exe (freebie)
http://www.youtube.com/watch?v=hTxsYTY2 ... re=related
free tool for screen capturing video of your desktop in real time, lots of well thought out and handy features

A+

---------------------------------------------------------------------

shame you cant send a single instruction to these devices

eg take snap shot
record start, record end

it might be easier just to get freebasic to press a key on the keyboard than spend hours & hours coding away


lazy man finds the easy way and all that
Last edited by TESLACOIL on Jun 23, 2010 20:34, edited 4 times in total.
TESLACOIL
Posts: 1769
Joined: Jun 20, 2010 16:04
Location: UK
Contact:

just discovered a handy function

Post by TESLACOIL »

the pro9000 has motion detection (and face detection & tracking)

time & date stamped, printed in a box in the corner of the video
100th of a second intervals

(this could be read...pick 6 pixels at x,y if it reads 101101 then its number 6 etc etc, just find 6 pixels that change a lot)...

or the time of its existence noted, new file found at time x

then rename file "file x time"





ive got it set to capture videos 1 second in duration any time something moves (again u have sensitivity,duration sliders etc etc)

this gives me access to a stream of short video files that is continuously growing. should anything of interest happen in the view finder the pro9000 guns it down :-D

A+++++

now all i got to do is figure how to extract an image from a wmv file

shame it doesn't have motion capture for stills, if i can find a web cam that does this that will solve my problem (id buy a camera just for that ability)

if your goal is too see the world, this is best done by examining single frames or short clips with a high level of scrutiny....wont do for playing table tennis...but it is the best way to understand the world and that's how human & animal/insect vision works most of the time

the human brain does not do Full Motion Video
...its just not powerful enough... it creates a heavily quantized illusion instead

you don't see the world in FMV....you just think you do

----------------------------------------------------------
consider

if your eyes were the most important thing for "seeing the world"

then if you were blind u would be totally stuffed, in truth a blindperson is only mildly handicapped in terms of "seeing the world"

you can test this out by walking round your house and carrying out tasks, but do so Blinking your eyes "open" briefly once a second...you hardly notice any difference in your capabilities (ping pong aside)

the reason being is that 90% of "what you see" comes not from your eyes but inside your head....mother nature is a pretty smart & ruthlessly efficient programmer (most of the time)

your brain is like a phosphorescant screen, picture is retained while the brains updates your VR screen
Post Reply