コード例 #1
0
        public void TestFinalPtzParams(Image imageR, Image imageP, ref double pan, ref double tilt, ref int zoom)
        {
            MemoryStream rStream = new MemoryStream();
            MemoryStream pStream = new MemoryStream();

            imageR.Save(rStream, System.Drawing.Imaging.ImageFormat.Png);
            imageP.Save(pStream, System.Drawing.Imaging.ImageFormat.Png);
            byte[] pixelsR = rStream.ToArray();
            byte[] pixelsP = pStream.ToArray();

            AlgorithmCpp.finalPTZParams(pixelsR, pixelsR.Count(), pixelsP, pixelsP.Count(), ref pan, ref tilt, ref zoom);

            rStream.Close();
            rStream.Dispose();
            pStream.Close();
            pStream.Dispose();
        }
コード例 #2
0
        public Image ConvertImage(Image image)
        {
            MemoryStream convertedImageMemoryStream;

            using (MemoryStream sourceImageStream = new MemoryStream())
            {
                image.Save(sourceImageStream, System.Drawing.Imaging.ImageFormat.Png);
                byte[]    sourceImagePixels = sourceImageStream.ToArray();
                ImageInfo imInfo            = new ImageInfo();
                AlgorithmCpp.convertToGray(sourceImagePixels, sourceImagePixels.Count(), ref imInfo);

                byte[] imagePixels = new byte[imInfo.size];
                Marshal.Copy(imInfo.data, imagePixels, 0, imInfo.size);
                if (imInfo.data != IntPtr.Zero)
                {
                    AlgorithmCpp.ReleaseMemoryFromC(imInfo.data);
                }
                convertedImageMemoryStream = new MemoryStream(imagePixels);
            }
            Image processed = new Bitmap(convertedImageMemoryStream);

            return(processed);
        }
コード例 #3
0
 public void TestFirstAproximation(int[] p1, int[] p2, ref double pan, ref double tilt)
 {
     AlgorithmCpp.firstAproximation(p1, p2, ref pan, ref tilt);
 }