JaJaPuppy

Hi all,

I have spent the last two weeks trying to find this out to no avail, and I wondered if anyone on here could assist.

I have written some code that binds streaming video to a picture box, and allows you to capture and save the current frame. This is using avicap32.dll and all works brilliantly. The only problem I have is I need to be able to Zoom the camera in and out. I can't use third party controls because of the enviroment I am working in, so will have to code the solution myself.

Any assistance would be greatly appreciated.

Thanks

Steve



Re: Visual Basic General Return of the webcam!

JaJaPuppy

Can anyone point me in the right direction



Re: Visual Basic General Return of the webcam!

JaJaPuppy

Is there nobody on here who ever needed or wanted to be able to do this

Is there anyone who cna give me a clue where to look to find this out

Does anyone know of any documentation available for avicap32.dll

Please can someone help.

Thanks

Steve





Re: Visual Basic General Return of the webcam!

Bruno Yu - MSFT

JajaPuppy,

1. Scanning And Imaging

http://www.codeproject.com/useritems/Abs_Scanning_Imaging.asp

Two In One Application to Scan a document and Capture Images using Web Cam,

2. This program shows how to capture live video from a web cam and display it in a picture box.

Code Snippet

Option Explicit On

Const ws_visible = &H10000000

Const ws_child = &H40000000

Const WM_USER = 1024

Const WM_CAP_EDIT_COPY = WM_USER + 30

Const wm_cap_driver_connect = WM_USER + 10

Const wm_cap_set_preview = WM_USER + 50

Const wm_cap_set_overlay = WM_USER + 51

Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52

Const WM_CAP_SEQUENCE = WM_USER + 62

Const WM_CAP_SINGLE_FRAME_OPEN = WM_USER + 70

Const WM_CAP_SINGLE_FRAME_CLOSE = WM_USER + 71

Const WM_CAP_SINGLE_FRAME = WM_USER + 72

Const DRV_USER = &H4000

Const DVM_DIALOG = DRV_USER + 100

Const PREVIEWRATE = 30

Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal a As String, ByVal b As Long, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f As Integer, ByVal g As Long, ByVal h As Integer) As Long

Dim hwndc As Long

Dim saveflag As Integer

Dim pictureindex As Integer

Dim filter1(-1 To 1, -1 To 1) As Single

Dim filter2(-1 To 1, -1 To 1) As Single

Dim temp As String

Private Sub Command2_Click()

Unload(Me)

End Sub

Private Sub Form_Load()

On Error GoTo handler

hwndc = capCreateCaptureWindow("CaptureWindow", ws_child Or ws_visible, 0, 0, PichWnd.Width, PichWnd.Height, PichWnd.hWnd, 0)

If (hwndc <> 0) Then

temp = SendMessage(hwndc, wm_cap_driver_connect, 0, 0)

temp = SendMessage(hwndc, wm_cap_set_preview, 1, 0)

temp = SendMessage(hwndc, WM_CAP_SET_PREVIEWRATE, PREVIEWRATE, 0)

temp = SendMessage(Me.hWnd, WM_CAP_EDIT_COPY, 1, 0)

Picture1.Picture = Clipboard.GetData

Else

MsgBox("Unable to capture video.", vbCritical)

End If

Exit Sub

handler:

End

End Sub

3. AVICAP32.DLL sucks (from the MSLU point of view)

http://blogs.msdn.com/michkap/archive/2005/04/13/407912.aspx

I am sure there are people who look at this DLL as being the answer to their prayers in terms of providing helpful interface to AVI capabilities.






Re: Visual Basic General Return of the webcam!

JaJaPuppy

Hi Bruno.

Thanks for the reply.

My problem isnt the actual capture of the video. I have managed to get that running OK. The problem I have is I can't find a way of contolling the zoom function of the camera (which, by the way, is a Microsoftr Lifecam VX-6000). I can not find anyone on the web who seems to have coded the zoom function.

If you can shed any light on zooming I would be greatful.

Thanks

Steve





Re: Visual Basic General Return of the webcam!

Bruno Yu - MSFT

JaJaPuppy,

1. Mouse Zoom-Camera Add-In

http://www.devx.com/vb2themax/CodeDownload/19771 type=kbSampleProd&trk=MSCP

This add-in adds a tool-window to your VB IDE. Initially, mousecam will be off. Start it with the on/off button. The initial snapshot interval is 100 ms. You can change this by clicking the interval button. The initial zoom is 100%. You can go up to 9900% by clicking the zoom-in button. When the zoom is more than 100%, the 1:1 button will be enabled. Clicking this button sets the zoom to 100%, and makes the ZoomBack button enabled. You can go back to the last zoom level, by clicking the ZoomBack button. This add-in comes with complete and commented source code.

2. Simple zoom functionality for custom controls

http://www.codeproject.com/cs/miscctrl/ZoomControl.asp

There were many users who had problems using the described routines in their own code. That is the reason I decided to program a custom control library (UniversalControl.dll) and provide it with a demo project. I also added a vertical and horizontal scrollbar to the control, because it seemed to be an indispensable feature.

3. True OpenGL Zooming

http://www.codeproject.com/opengl/opengl_zooming.asp

The topic of this article is focused around zooming in a perspective OpenGL view.






Re: Visual Basic General Return of the webcam!

JaJaPuppy

Hi Bruno,

Appologies for the delay,

I have had a look around and a play with your suggestions and come up with a solution. Basically zooming the image rather than the camera.

Thanks very much for your help

Steve





Re: Visual Basic General Return of the webcam!

JaJaPuppy

Hi all,

Me again.

All was going well till they went and bought a laptop with a built in webcam. Now my software picks one a random and uses that for the video (somewhat annoying to say the least) - SO -

Can anyone tell me how to pick a camera to use, I suspect it is related to DVM_DIALOG but my experiments have not been too sucessful.

Any help would be appreciated,

Thanks

Steve





Re: Visual Basic General Return of the webcam!

Bruno Yu - MSFT

JaJaPuppy,

Nice to see you again! Could you please post the question in a new thread in order to generate more helpful answers This thread is too old to pay the community attention.

I strongly recommend you to create a new thread on the issue. Thanks again for your question!






Re: Visual Basic General Return of the webcam!

JaJaPuppy

Consider it done

Thanks