Professional Documents
Culture Documents
The class will make it easy for your app to view a webcamera set FPS etc.
Ok the class,
Code:
Private CamFrameRate As Integer = 15
Private OutputHeight As Integer = 240
Private OutputWidth As Integer = 360
CamFrameRate - Starting frame rate how much of a gap there is between frames 15ms
(About 65 FPS) NOTE - You can changes the FPS through a sub this is just the initial frame
rate.
VB Code:
1. Public iRunning As Boolean
This can be called at anytime and will return if the camera is running or not
VB Code:
1. Messagebox.show Mycam.Irunning
VB Code:
1. Private myCam As iCam
2.
3.
4. Set myCam = New iCam
From here you can call a range of functions using the syntax,
VB Code:
1. mycam.[Function Name]
Functions
VB Code:
1. myCam.initCam(Me.picOutput.Handle.ToInt32)
resetCam()
- If you need to reset the camera call this function, you most proberly wont but its here
incase you do
VB Code:
1. MyCam.ResetCam()
VB Code:
1. myCam.setFrameRate(25)
closeCam()
- Allways call when closing the application, just clears things up.
VB Code:
1. myCam.CloseCam()
VB Code:
1. Me.picStill.Image = myCam.copyFrame(Me.picOutput, New
RectangleF(0, 0, _
2.
3. Me.picOutput.Width,
Me.picOutput.Height))
FPS()
- This sub returns the current FPS
VB Code:
1. MessageBox.Show MyCam.Fps()
As I say code may not be great but it works good, and i just hope sompeople may find it
useful. I'd appriciate people not replying here but Pm'ing me with any problems since i'd like
to keep this thread as clean as possible!
Pino
Attached Files
iCam Class.zip (1.5 KB, 55155 views)
WebCamViewer.zip (28.6 KB, 48516 views)