public SubclassCanny(SuperclassImage Image, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     //_image = Image.GetImage();
     image = ImageMethod(Image.GetImage());
     description = Description;
 }
 public SubclassGrayvalue(SuperclassImage Image, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     // _image = Image.GetImage();
     image       = ImageMethod(Image.GetImage());
     description = Description;
 }
Example #3
0
 public SubclassZoomOut(SuperclassImage Image, double size, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     //_image = Image;
     _size       = size;
     image       = ImageMethod(Image.GetImage());
     description = Description;
 }
 public SubclassZoomOut(SuperclassImage Image, double size, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     //_image = Image;
     _size = size;
     image = ImageMethod(Image.GetImage());
     description = Description;
 }
 public SubclassRotate(SuperclassImage Image, int degree, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     //classImage.GetImage = Image.GetImage();
     //_image = Image.GetImage();
     _degree     = degree;
     image       = ImageMethod(Image.GetImage());
     description = Description;
 }
 public SubclassRotate(SuperclassImage Image, int degree, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     //classImage.GetImage = Image.GetImage();
     //_image = Image.GetImage();
     _degree = degree;
     image = ImageMethod(Image.GetImage());
     description = Description;
 }
        private void Photo_Click(object sender, RoutedEventArgs e)
        {
            string Date = DateTime.Now.ToString("MM/dd/yyyy");

            photoFlag          = false;
            schetchPhotoObject = new SubclassScretchedphoto(frame, "The photo taken on" + Date);

            //Image<Bgr, Byte> result = schetchPhotoObject.GetImage() as Image<Bgr, Byte>;
            //label1.Content = result.Width;
            //label2.Content = result.Height;
            //Image image1= BitmapSourceConvert.ToBitmapSource(schetchPhotoObject.GetImage());
            DescriptionChange(schetchPhotoObject);
        }
 private void GrayValue_Click(object sender, RoutedEventArgs e)
 {
     if (schetchPhotoObject != null)
     {
         schetchPhotoObject = new SubclassGrayvalue(schetchPhotoObject, "alter to gray value 1 time");
         DescriptionChange(schetchPhotoObject);
         frame = schetchPhotoObject.GetImage();
         Image schetchPhoto2 = new Image();
         schetchPhoto2.Source = BitmapSourceConvert.ToBitmapSource(frame);
         schetchPhoto2.Width  = 500;
         schetchPhoto2.Height = 500;
         schetchPhotoToSave   = schetchPhoto2;
         Canvas.SetTop(schetchPhoto2, 0);
         Canvas.SetLeft(schetchPhoto2, 150);
         Canvas myCanvas2 = new Canvas();
         myCanvas2.Children.Add(schetchPhoto2);
         grid1.Children.Add(myCanvas2);
     }
 }
        //public static class BitmapSourceConvert
        //{
        //    [DllImport("gdi32")]
        //    private static extern int DeleteObject(IntPtr o);

        //    public static BitmapSource ToBitmapSource(IImage image)
        //    {
        //        if (image != null)
        //        {
        //            using (System.Drawing.Bitmap source = image.Bitmap)
        //            {
        //                IntPtr ptr = source.GetHbitmap();

        //                BitmapSource bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
        //                    ptr,
        //                    IntPtr.Zero,
        //                    Int32Rect.Empty,
        //                    System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());

        //                DeleteObject(ptr);
        //                return bs;
        //            }
        //        }
        //        else
        //        {
        //            return null;
        //        }
        //    }
        //}

        public void DescriptionChange(SuperclassImage Image)
        {

            textBlock1.Text = Image.GetDescription();
        }
 private void GrayValue_Click(object sender, RoutedEventArgs e)
 {
     if (schetchPhotoObject != null)
     {
         schetchPhotoObject = new SubclassGrayvalue(schetchPhotoObject, "alter to gray value 1 time");
         DescriptionChange(schetchPhotoObject); 
         frame = schetchPhotoObject.GetImage();
         Image schetchPhoto2 = new Image();
         schetchPhoto2.Source = BitmapSourceConvert.ToBitmapSource(frame);
         schetchPhoto2.Width = 500;
         schetchPhoto2.Height = 500;
         schetchPhotoToSave = schetchPhoto2;
         Canvas.SetTop(schetchPhoto2, 0);
         Canvas.SetLeft(schetchPhoto2, 150);
         Canvas myCanvas2 = new Canvas();
         myCanvas2.Children.Add(schetchPhoto2);
         grid1.Children.Add(myCanvas2);
     }
 }
        private void Photo_Click(object sender, RoutedEventArgs e)
        {
            string Date = DateTime.Now.ToString("MM/dd/yyyy");
            photoFlag = false;
            schetchPhotoObject = new SubclassScretchedphoto(frame, "The photo taken on" + Date);

            //Image<Bgr, Byte> result = schetchPhotoObject.GetImage() as Image<Bgr, Byte>;
            //label1.Content = result.Width;
            //label2.Content = result.Height;
            //Image image1= BitmapSourceConvert.ToBitmapSource(schetchPhotoObject.GetImage());
            DescriptionChange(schetchPhotoObject);
        }
        //public static class BitmapSourceConvert
        //{
        //    [DllImport("gdi32")]
        //    private static extern int DeleteObject(IntPtr o);

        //    public static BitmapSource ToBitmapSource(IImage image)
        //    {
        //        if (image != null)
        //        {
        //            using (System.Drawing.Bitmap source = image.Bitmap)
        //            {
        //                IntPtr ptr = source.GetHbitmap();

        //                BitmapSource bs = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
        //                    ptr,
        //                    IntPtr.Zero,
        //                    Int32Rect.Empty,
        //                    System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions());

        //                DeleteObject(ptr);
        //                return bs;
        //            }
        //        }
        //        else
        //        {
        //            return null;
        //        }
        //    }
        //}

        public void DescriptionChange(SuperclassImage Image)
        {
            textBlock1.Text = Image.GetDescription();
        }
Example #13
0
 public SuperclassImageProcessMethod(SuperclassImage Image, string Description)
 {
     _image      = Image.GetImage();
     image       = Image.GetImage();
     description = Description;
 }
        //private SuperclassImage imageTemp = null;
        //private SuperclassImage returnImage = null;
        public SubclassWallpaper(IImage frameP, ref SuperclassImage image)
        {
            frame = frameP;
            if (frame == null)
            {
                Console.WriteLine("null");
            }
            //image = new SubclassCanny(frame, "");
            image = new SubclassScretchedphoto(frame, "");
            image = new SubclassCanny(image, "");
            //imageTemp.GetImage();
            image = new SubclassCanny(image, "");
            Image <Gray, Byte> image1 = image.GetImage() as Image <Gray, Byte>;

            //Image<Rgb, Byte> image2 = new Image<Rgb, Byte>;
            //Image<Rgb, Byte> image3 = image.GetImage() as Image<Rgb, Byte>;
            //Image<Rgb, Byte> image4 = image.GetImage() as Image<Rgb, Byte>;
            //Image<Rgb, Byte> image5 = image.GetImage() as Image<Rgb, Byte>;
            Console.WriteLine("{0}", image1.Rows);
            Console.WriteLine("{0}", image1.Width);
            Image <Bgr, Byte> image6 = new Image <Bgr, Byte>(image1.Width * 2, image1.Height * 2);

            for (int i = 0; i < image1.Rows; i++)
            {
                for (int j = 0; j < image1.Cols; j++)
                {
                    if ((image1.Data[i, j, 0] == 0))
                    {
                        for (int z = 0; z < 3; z++)
                        {
                            image6.Data[i, j, z] = 0;
                            image6.Data[i + image1.Rows, j, z] = 0;
                            image6.Data[i + image1.Rows, j + image1.Cols, z] = 0;
                            image6.Data[i, j + image1.Cols, z] = 0;
                        }
                        image6.Data[i, j, 0] = 0;
                        image6.Data[i, j, 1] = 106;
                        image6.Data[i, j, 2] = 237;

                        image6.Data[i + image1.Rows, j, 0] = 170;
                        image6.Data[i + image1.Rows, j, 1] = 187;
                        image6.Data[i + image1.Rows, j, 2] = 0;

                        image6.Data[i + image1.Rows, j + image1.Cols, 0] = 83;
                        image6.Data[i + image1.Rows, j + image1.Cols, 1] = 242;
                        image6.Data[i + image1.Rows, j + image1.Cols, 2] = 255;

                        image6.Data[i, j + image1.Cols, 0] = 237;
                        image6.Data[i, j + image1.Cols, 1] = 180;
                        image6.Data[i, j + image1.Cols, 2] = 0;

                        //image1.Data[i, j, 0] = 255;
                        //image2.Data[i, j, 1] = 255;
                        //image3.Data[i, j, 2] = 255;
                    }
                    else
                    {
                        image6.Data[i, j, 0] = 255;
                        image6.Data[i, j, 1] = 255;
                        image6.Data[i, j, 2] = 255;
                    }
                    //for (int z = 0; z < 1; z++)
                    //{
                    //    image6.Data[i, j, z] = image1.Data[i, j, z];
                    //    image6.Data[i + image5.Rows / 2, j, z] = image2.Data[i, j, z];
                    //    image6.Data[i + image5.Rows / 2, j + image5.Cols / 2, z] = image3.Data[i, j, z];
                    //    image6.Data[i, j + image5.Cols / 2, z] = image4.Data[i, j, z];
                    //}
                }
            }
            image = new SubclassScretchedphoto(image6, "");
            //frame = schetchPhotoObject.GetImage();
            //Image schetchPhoto2 = new Image();
            //product.Source = image;
            product        = new Image();
            product.Source = BitmapSourceConvert.ToBitmapSource(image6);
            product.Width  = 500;
            product.Height = 500;
            //schetchPhotoToSave = schetchPhoto2;
            //Date = DateP;
            //this.takePhoto();
        }
        //private SuperclassImage imageTemp = null;
        //private SuperclassImage returnImage = null;
        public SubclassWallpaper(IImage frameP, ref SuperclassImage image)
        {
            frame = frameP;
            if (frame == null)
            {
                Console.WriteLine("null");
            }
            //image = new SubclassCanny(frame, "");
            image = new SubclassScretchedphoto(frame, "");
            image = new SubclassCanny(image, "");
            //imageTemp.GetImage();
            image = new SubclassCanny(image, "");
            Image<Gray, Byte> image1 = image.GetImage() as Image<Gray, Byte>;

            //Image<Rgb, Byte> image2 = new Image<Rgb, Byte>;
            //Image<Rgb, Byte> image3 = image.GetImage() as Image<Rgb, Byte>;
            //Image<Rgb, Byte> image4 = image.GetImage() as Image<Rgb, Byte>;
            //Image<Rgb, Byte> image5 = image.GetImage() as Image<Rgb, Byte>;
            Console.WriteLine("{0}", image1.Rows);
            Console.WriteLine("{0}", image1.Width);
            Image<Bgr, Byte> image6 = new Image<Bgr, Byte>(image1.Width*2, image1.Height*2);
            for (int i = 0; i < image1.Rows; i++)
            {
                for (int j = 0; j < image1.Cols; j++)
                {
                    if ((image1.Data[i, j, 0] == 0))
                    {
                        for (int z = 0; z < 3; z++)
                        {
                            image6.Data[i, j, z] = 0;
                            image6.Data[i + image1.Rows, j, z] = 0;
                            image6.Data[i + image1.Rows, j + image1.Cols, z] = 0;
                            image6.Data[i, j + image1.Cols, z] = 0;
                        }
                        image6.Data[i, j, 0] = 0;
                        image6.Data[i, j, 1] = 106;
                        image6.Data[i, j, 2] = 237;

                        image6.Data[i + image1.Rows, j, 0] = 170;
                        image6.Data[i + image1.Rows, j, 1] = 187;
                        image6.Data[i + image1.Rows, j, 2] = 0;

                        image6.Data[i + image1.Rows, j + image1.Cols, 0] = 83;
                        image6.Data[i + image1.Rows, j + image1.Cols, 1] = 242;
                        image6.Data[i + image1.Rows, j + image1.Cols, 2] = 255;

                        image6.Data[i, j + image1.Cols, 0] = 237;
                        image6.Data[i, j + image1.Cols, 1] = 180;
                        image6.Data[i, j + image1.Cols, 2] = 0;

                        //image1.Data[i, j, 0] = 255;
                        //image2.Data[i, j, 1] = 255;
                        //image3.Data[i, j, 2] = 255;
                    }
                    else
                    {
                        image6.Data[i, j, 0] = 255;
                        image6.Data[i, j, 1] = 255;
                        image6.Data[i, j, 2] = 255;
                    }
                    //for (int z = 0; z < 1; z++)
                    //{
                    //    image6.Data[i, j, z] = image1.Data[i, j, z];
                    //    image6.Data[i + image5.Rows / 2, j, z] = image2.Data[i, j, z];
                    //    image6.Data[i + image5.Rows / 2, j + image5.Cols / 2, z] = image3.Data[i, j, z];
                    //    image6.Data[i, j + image5.Cols / 2, z] = image4.Data[i, j, z];
                    //}
                }
            }
            image = new SubclassScretchedphoto(image6, "");
            //frame = schetchPhotoObject.GetImage();
            //Image schetchPhoto2 = new Image();
            //product.Source = image;
            product = new Image();
            product.Source = BitmapSourceConvert.ToBitmapSource(image6);
            product.Width = 500;
            product.Height = 500;
            //schetchPhotoToSave = schetchPhoto2;
            //Date = DateP;
            //this.takePhoto();
        }
 public SuperclassImageProcessMethod(SuperclassImage Image, string Description)
 {
     _image = Image.GetImage();
     image = Image.GetImage();
     description = Description;
 }