示例#1
0
        /// <summary>
        /// shows the detected centre square
        /// </summary>
        /// <param name="filename">raw image filename</param>
        /// <param name="square">square to be displayed</param>
        /// <param name="output_filename">filename to save as</param>
        private static void ShowSquare(string filename, polygon2D square,
                                       string output_filename)
        {
            Bitmap bmp = (Bitmap)Bitmap.FromFile(filename);
            byte[] img = new byte[bmp.Width * bmp.Height * 3];
            BitmapArrayConversions.updatebitmap(bmp, img);
            square.show(img, bmp.Width, bmp.Height, 0, 255, 0, 0);

            Bitmap output_bmp = new Bitmap(bmp.Width, bmp.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            BitmapArrayConversions.updatebitmap_unsafe(img, output_bmp);
            if (output_filename.ToLower().EndsWith("jpg"))
                output_bmp.Save(output_filename, System.Drawing.Imaging.ImageFormat.Jpeg);
            if (output_filename.ToLower().EndsWith("bmp"))
                output_bmp.Save(output_filename, System.Drawing.Imaging.ImageFormat.Bmp);
        }
示例#2
0
 public static byte[] ShowRawImagePerimeter(byte[] img, int img_width, int img_height,
                                            polygon2D perim,
                                            int r, int g, int b,
                                            int line_width)
 {
     byte[] new_img = (byte[])img.Clone();
     perim.show(new_img, img_width, img_height,
                r, g, b, line_width);
     return(new_img);
 }