|
-
Jul 9th, 2007, 06:49 PM
#23
New Member
Re: Video capture
Hi friends,
I´m using the codes you showed in this thread to capture a photo with a generic webcam my client has bought.
The point is that I´m not able to define the size of the captured image. I´m not talking about fitting the image to the picturebox in wich I show it. Indeed it's done by the code I´ve got. What I need is to capture exactly what I see once the image saved is much bigger than the one who appears in the picture box.
Can anyone help me? Thank you in advance. (Below, please find the code I´m using).
To initialize the camera
Private Sub PreviewVideo(ByVal pbCtrl As PictureBox)
On Error GoTo treatment:
mHwnd = capCreateCaptureWindowA("Teste", WS_VISIBLE Or WS_CHILD, 0, 0, 100, 100, pbCtrl.hwnd, 0)
If SendMessage(mHwnd, WM_CAP_DRIVER_CONNECT, 0, 0) Then
SendMessage mHwnd, WM_CAP_SET_SCALE, False, 0
'---set the preview rate (ms)---
SendMessage mHwnd, WM_CAP_SET_PREVIEWRATE, 30, 0
'---start previewing the image---
SendMessage mHwnd, WM_CAP_SET_PREVIEW, True, 0
'---resize window to fit in PictureBox control---
SetWindowPos mHwnd, HWND_BOTTOM, 0, 0, pbCtrl.ScaleWidth, pbCtrl.ScaleHeight, SWP_NOMOVE Or SWP_NOZORDER
Else
'--error connecting to video source---
MsgBox "Problema na conexão com a câmera. Contate o suporte!! - " & Err.Description
DestroyWindow mHwnd
End If
Exit Sub
treatment:
MsgBox "Problema na conexão com a câmera. Contate suporte!!!" & Err.Description
End Sub
to capture the image
Private Sub cmdCapturar_Click()
SendMessage mHwnd, GET_FRAME, 0, 0
SendMessage mHwnd, COPY, 0, 0
Picture1.Picture = Clipboard.GetData
Clipboard.Clear
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|