Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim nReval As Integer
- Dim nLastErrorNo As Integer
- Dim nBufferSize As Integer
- Dim dwWidth As Integer
- Dim dwHeight As Integer
- Dim dwLinePitch As Integer
- nReval = StCam.GetPreviewDataSize(m_hCamera, nBufferSize, dwWidth, dwHeight, dwLinePitch)
- Dim dwPreviewPixelFormat As Integer
- nReval = StCam.GetPreviewPixelFormat(m_hCamera, dwPreviewPixelFormat)
- Dim pixelFormat As Imaging.PixelFormat = Imaging.PixelFormat.Format8bppIndexed
- Select Case dwPreviewPixelFormat
- Case StCam.STCAM_PIXEL_FORMAT_24_BGR
- pixelFormat = Imaging.PixelFormat.Format24bppRgb
- Case StCam.STCAM_PIXEL_FORMAT_32_BGR
- pixelFormat = Imaging.PixelFormat.Format32bppRgb
- End Select
- Dim pbyteImageBuffer(nBufferSize) As Byte
- Dim dwNumberOfByteTrans As Integer = 0
- Dim pdwFrameNo(1) As Integer
- Dim dwMilliseconds As Integer = 600
- Dim gch As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(pbyteImageBuffer, System.Runtime.InteropServices.GCHandleType.Pinned)
- Dim ptr As IntPtr = gch.AddrOfPinnedObject()
- nReval = StCam.TakePreviewSnapShot(m_hCamera, ptr, nBufferSize, dwNumberOfByteTrans, pdwFrameNo, dwMilliseconds)
- dim bmp as Bitmap
- Using ms As New IO.MemoryStream(pbyteImageBuffer)
- bmp = new Bitmap(ms)
- End Using
- PictureBox5.Image = EdgeDetectWithInvert(bmp, LogInTrackBar4.Value - 20)
- PictureBox5.Refresh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement