Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.64 KB | None | 0 0
  1.             Dim nReval As Integer
  2.             Dim nLastErrorNo As Integer
  3.             Dim nBufferSize As Integer
  4.             Dim dwWidth As Integer
  5.             Dim dwHeight As Integer
  6.             Dim dwLinePitch As Integer
  7.             nReval = StCam.GetPreviewDataSize(m_hCamera, nBufferSize, dwWidth, dwHeight, dwLinePitch)
  8.             Dim dwPreviewPixelFormat As Integer
  9.             nReval = StCam.GetPreviewPixelFormat(m_hCamera, dwPreviewPixelFormat)
  10.             Dim pixelFormat As Imaging.PixelFormat = Imaging.PixelFormat.Format8bppIndexed
  11.             Select Case dwPreviewPixelFormat
  12.                 Case StCam.STCAM_PIXEL_FORMAT_24_BGR
  13.                     pixelFormat = Imaging.PixelFormat.Format24bppRgb
  14.                 Case StCam.STCAM_PIXEL_FORMAT_32_BGR
  15.                     pixelFormat = Imaging.PixelFormat.Format32bppRgb
  16.             End Select
  17.             Dim pbyteImageBuffer(nBufferSize) As Byte
  18.             Dim dwNumberOfByteTrans As Integer = 0
  19.             Dim pdwFrameNo(1) As Integer
  20.             Dim dwMilliseconds As Integer = 600
  21.             Dim gch As System.Runtime.InteropServices.GCHandle = System.Runtime.InteropServices.GCHandle.Alloc(pbyteImageBuffer, System.Runtime.InteropServices.GCHandleType.Pinned)
  22.             Dim ptr As IntPtr = gch.AddrOfPinnedObject()
  23.             nReval = StCam.TakePreviewSnapShot(m_hCamera, ptr, nBufferSize, dwNumberOfByteTrans, pdwFrameNo, dwMilliseconds)
  24.  
  25.             dim bmp as Bitmap
  26.             Using ms As New IO.MemoryStream(pbyteImageBuffer)
  27.                 bmp = new Bitmap(ms)
  28.             End Using
  29.  
  30.             PictureBox5.Image = EdgeDetectWithInvert(bmp, LogInTrackBar4.Value - 20)
  31.             PictureBox5.Refresh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement