I have a nice little camera that I control via vb.net. It works fine
but it has a build in capture feature that is just too slow.
Dim snapBuffer(3533600)() As Byte 'raw video data
Dim FrameRGB24(10500000) As Byte 'rgb buffer
Dim DeviceH As Integer
Dim ResultOk As Object
Dim bm_gr As Graphics = eventSender.Picture1.CreateGraphics()
Dim bitM As Bitmap = New Bitmap(eventSender.Picture1.Width,
eventSender.Picture1.Height, Imaging.PixelFormat.Format24bppRgb)
Dim snapImage As Imaging.BitmapData
Dim rect1 As Rectangle = New Rectangle(0, 0,
eventSender.Picture1.Width, eventSender.Picture1.Height)
DeviceH = VbOpenDevice(DevNumber)
ResultOk=vbstartvideo(DeviceH)
For i = 0 To 23
ReDim snapBuffer(i)(3533600)
* * * ResultOk = VbGrabVideoFrame(DeviceH, snapBuffer(i), Params.Width
* Params.Height) * * *
(this is the line I would like to replace)
Next i
For i = 0 To 23
snapImage = bitM.LockBits(rect1, Imaging.ImageLockMode.WriteOnly,
Imaging.PixelFormat.Format24bppRgb)
VbBayerToRgb(snapBuffer(i), Params.Height, Params.Width, 1, FrameRGB24)
System.Runtime.InteropServices.Marshal.Copy(FrameR GB24, 0,
snapImage.Scan0, Params.Width * Params.Height * 3)
bitM.Save("SNAP" + CStr(i) + ".bmp", Imaging.ImageFormat.Bmp)
bitM.UnlockBits(snapImage)
Next i
Me.Picture1.BackColor = System.Drawing.SystemColors.Control
Me.Picture1.BorderStyle =
System.Windows.Forms.BorderStyle.Fixed3D
Me.Picture1.Cursor = System.Windows.Forms.Cursors.Default
Me.Picture1.Font = New System.Drawing.Font("Arial", 8.0!,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
CType(0, Byte))
Me.Picture1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Picture1.Location = New System.Drawing.Point(8, 16)
Me.Picture1.Name = "Picture1"
Me.Picture1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Picture1.Size = New System.Drawing.Size(400, 400)
Me.Picture1.TabIndex = 3
Me.Picture1.TabStop = False
Does anybody know how to grab video directly from the picture object?