示例#1
0
        public static bool CvtBitmap2CImage(Bitmap bitmap, ref CImage image)
        {
            switch (bitmap.PixelFormat)
            {
            case PixelFormat.Format24bppRgb:
                image.nChannels = 3;
                break;

            case PixelFormat.Format32bppRgb:
                image.nChannels = 4;
                break;

            case PixelFormat.Format8bppIndexed:
                image.nChannels = 1;
                break;

            default:
                return(false);
            }
            image.nWidth  = bitmap.Width;
            image.nHeight = bitmap.Height;

            if (bitmap.Width % 4 != 0)
            {
                int   w = bitmap.Width - bitmap.Width % 4;
                float h = (float)bitmap.Height / (float)bitmap.Width * (float)w;
                bitmap = bitmap.GetThumbnailImage(w, (int)h, null, IntPtr.Zero) as Bitmap;
            }
            BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                                                 ImageLockMode.ReadOnly, bitmap.PixelFormat);

            image.pData = bmpData.Scan0;

            bitmap.UnlockBits(bmpData);

            return(true);
        }
 public extern static ErrorCode CaptureImage(
     ulong hHandle,
     ref CImage cImage
     );
 public extern static ErrorCode Init(ref ulong hHandle, ref CImage cImage);
示例#4
0
 public extern static ErrorCode GetVideoFrame(
     ulong hHandle,
     ref CImage cImage
     );
示例#5
0
 public extern static ErrorCode LoadVideo(
     IntPtr pVideoFile,
     int nVideoFileStrLength,
     ref ulong hHandle,
     ref CImage cImage
     );
示例#6
0
 public extern static ErrorCode DrawResult2Image(
     ref CImage cImage,
     BUAnalysisResult pResult
     );
示例#7
0
 public extern static ErrorCode ExecuteBUAnalysisFromImage(
     ulong hHandle,
     CImage cImage,
     ref BUAnalysisResult pResult
     );