public SubclassGrayvalue(SuperclassImage Image, string Description)
     : base(Image, Description)
 {
     classImage = Image;
    // _image = Image.GetImage();
     image = ImageMethod(Image.GetImage());
     description = Description;
 }
Ejemplo n.º 2
0
 public SubclassCanny(SuperclassImage Image, string Description)
     : base(Image, Description)
 {
     classImage = Image;
     //_image = Image.GetImage();
     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 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();
        }
Ejemplo n.º 10
0
        //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();
        }
Ejemplo n.º 11
0
 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);
     }
 }
Ejemplo n.º 12
0
        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 SuperclassImageProcessMethod(SuperclassImage Image, string Description)
 {
     _image = Image.GetImage();
     image = Image.GetImage();
     description = Description;
 }
Ejemplo n.º 14
0
 public SuperclassImageProcessMethod(SuperclassImage Image, string Description)
 {
     _image      = Image.GetImage();
     image       = Image.GetImage();
     description = Description;
 }
Ejemplo n.º 15
0
        //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);
            productImage = 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++)
                        {
                            productImage.Data[i, j, z] = 0;
                            productImage.Data[i + image1.Rows, j, z] = 0;
                            productImage.Data[i + image1.Rows, j + image1.Cols, z] = 0;
                            productImage.Data[i, j + image1.Cols, z] = 0;
                        }
                        productImage.Data[i, j, 0] = 0;
                        productImage.Data[i, j, 1] = 106;
                        productImage.Data[i, j, 2] = 237;

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

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

                        productImage.Data[i, j + image1.Cols, 0] = 237;
                        productImage.Data[i, j + image1.Cols, 1] = 180;
                        productImage.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
                    {
                        productImage.Data[i, j, 0] = 255;
                        productImage.Data[i, j, 1] = 255;
                        productImage.Data[i, j, 2] = 255;
                    }
                    //for (int z = 0; z < 1; z++)
                    //{
                    //    productImage.Data[i, j, z] = image1.Data[i, j, z];
                    //    productImage.Data[i + image5.Rows / 2, j, z] = image2.Data[i, j, z];
                    //    productImage.Data[i + image5.Rows / 2, j + image5.Cols / 2, z] = image3.Data[i, j, z];
                    //    productImage.Data[i, j + image5.Cols / 2, z] = image4.Data[i, j, z];
                    //}
                }
            }
            image = new SubclassScretchedphoto(productImage, "");
            //frame = schetchPhotoObject.GetImage();
            //Image schetchPhoto2 = new Image();
            //product.Source = image;
            product        = new Image();
            product.Source = BitmapSourceConvert.ToBitmapSource(productImage);
            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);
            productImage = 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++)
                        {
                            productImage.Data[i, j, z] = 0;
                            productImage.Data[i + image1.Rows, j, z] = 0;
                            productImage.Data[i + image1.Rows, j + image1.Cols, z] = 0;
                            productImage.Data[i, j + image1.Cols, z] = 0;
                        }
                        productImage.Data[i, j, 0] = 0;
                        productImage.Data[i, j, 1] = 106;
                        productImage.Data[i, j, 2] = 237;

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

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

                        productImage.Data[i, j + image1.Cols, 0] = 237;
                        productImage.Data[i, j + image1.Cols, 1] = 180;
                        productImage.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
                    {
                        productImage.Data[i, j, 0] = 255;
                        productImage.Data[i, j, 1] = 255;
                        productImage.Data[i, j, 2] = 255;
                    }
                    //for (int z = 0; z < 1; z++)
                    //{
                    //    productImage.Data[i, j, z] = image1.Data[i, j, z];
                    //    productImage.Data[i + image5.Rows / 2, j, z] = image2.Data[i, j, z];
                    //    productImage.Data[i + image5.Rows / 2, j + image5.Cols / 2, z] = image3.Data[i, j, z];
                    //    productImage.Data[i, j + image5.Cols / 2, z] = image4.Data[i, j, z];
                    //}
                }
            }
            image = new SubclassScretchedphoto(productImage, "");
            //frame = schetchPhotoObject.GetImage();
            //Image schetchPhoto2 = new Image();
            //product.Source = image;
            product = new Image();
            product.Source = BitmapSourceConvert.ToBitmapSource(productImage);
            product.Width = 500;
            product.Height = 500;
            //schetchPhotoToSave = schetchPhoto2;
            //Date = DateP;
            //this.takePhoto();
        }