By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,584 Members | 3,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,584 IT Pros & Developers. It's quick & easy.

Problem With Capturing Frame from WebCam

P: 1
I am attempting to use code from this site to capture a frame. Everything works except the bitmap returned to a picture box is weird. It has no color and looks like the image is repeated three times horizontally. For convenience I put the link to the page that has the source code I am using.

When I check the length of the returned bytes it is 61440 which seem really small for a color picture.

AS I think the problem is in the FrameCallbackTarget function, I included this code. I attached a screenshot of the problem Any help will be much appreciated.

- Carl

Public Function FrameCallbackTarget(ByVal hwnd As IntPtr, ByRef lpVHdr As VIDEOHDR) As IntPtr

If flgHaveImage Then

Dim x

x = lpVHdr.dwBytesUsed

Dim height As Integer = pixcapture.Size.Height
Dim width As Integer = pixcapture.Size.Width

oBMP = New Bitmap(width, height, (width * 3), Imaging.PixelFormat.Format24bppRgb, New System.IntPtr(lpVHdr.lpData))

pixcapture.Image = oBMP

flgHaveImage = False

End If

End Function
Attached Images
File Type: jpg Capture.jpg (65.7 KB, 35 views)
May 11 '18 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.