From b2ed1ed32a723b5e1dfdf108a3c59ff5f7817fe3 Mon Sep 17 00:00:00 2001 From: James South Date: Thu, 16 Apr 2015 22:35:42 +0100 Subject: [PATCH] Hiding object detection for now. Former-commit-id: c909fa7642dd268ae0fdea05e115a6156c4fc3f0 Former-commit-id: 69ab4af6853b6f8cf4b1aecbb31851c71a73c771 Former-commit-id: 33abf27816345bf05d12e8f74f28228fa59cef66 --- src/ImageProcessor.Playground/Program.cs | 20 ++++++++++------- src/ImageProcessor/ImageFactory.cs | 20 ++++++++--------- src/ImageProcessor/ImageProcessor.csproj | 22 ------------------- src/ImageProcessor/Imaging/FastBitmap.cs | 2 +- .../Imaging/Quantizers/OctreeQuantizer.cs | 10 ++++----- 5 files changed, 27 insertions(+), 47 deletions(-) diff --git a/src/ImageProcessor.Playground/Program.cs b/src/ImageProcessor.Playground/Program.cs index e403b59de..b3d5b35d1 100644 --- a/src/ImageProcessor.Playground/Program.cs +++ b/src/ImageProcessor.Playground/Program.cs @@ -21,7 +21,7 @@ namespace ImageProcessor.PlayGround using ImageProcessor.Configuration; using ImageProcessor.Imaging; using ImageProcessor.Imaging.Filters.EdgeDetection; - using ImageProcessor.Imaging.Filters.ObjectDetection; + //using ImageProcessor.Imaging.Filters.ObjectDetection; using ImageProcessor.Imaging.Filters.Photo; using ImageProcessor.Imaging.Formats; using ImageProcessor.Processors; @@ -60,13 +60,15 @@ namespace ImageProcessor.PlayGround //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "gamma-1.0-or-2.2.png")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "gamma_dalai_lama_gray.jpg")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Arc-de-Triomphe-France.jpg")); - //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Martin-Schoeller-Jack-Nicholson-Portrait.jpeg")); - FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "test2.png")); - + FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Martin-Schoeller-Jack-Nicholson-Portrait.jpeg")); + //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "test2.png")); + //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "120430.gif")); + //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "rickroll.original.gif")); + //////FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "crop-base-300x200.jpg")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "cmyk.png")); //IEnumerable files = GetFilesByExtensions(di, ".gif"); - IEnumerable files = GetFilesByExtensions(di, ".png", ".jpg", ".jpeg"); + //IEnumerable files = GetFilesByExtensions(di, ".png", ".jpg", ".jpeg"); //IEnumerable files = GetFilesByExtensions(di, ".jpg", ".jpeg", ".jfif"); //IEnumerable files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png"); @@ -88,7 +90,7 @@ namespace ImageProcessor.PlayGround { using (ImageFactory imageFactory = new ImageFactory(true, false)) { - Size size = new Size(500, 0); + Size size = new Size(600, 0); //CropLayer cropLayer = new CropLayer(20, 20, 20, 20, ImageProcessor.Imaging.CropMode.Percentage); //ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false); @@ -98,7 +100,7 @@ namespace ImageProcessor.PlayGround //}; // Load, resize, set the format and quality and save an image. imageFactory.Load(inStream) - .DetectObjects(EmbeddedHaarCascades.FrontFaceDefault) + //.DetectObjects(EmbeddedHaarCascades.FrontFaceDefault) //.Overlay(new ImageLayer // { // Image = overlay, @@ -113,7 +115,9 @@ namespace ImageProcessor.PlayGround //.Format(new PngFormat()) //.BackgroundColor(Color.Cyan) //.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128) - //.Resize(size) + //.GaussianSharpen(3) + //.Saturation(20) + .Resize(size) //.Resize(new ResizeLayer(size, ResizeMode.Max)) // .Resize(new ResizeLayer(size, ResizeMode.Stretch)) //.DetectEdges(new Laplacian3X3EdgeFilter(), true) diff --git a/src/ImageProcessor/ImageFactory.cs b/src/ImageProcessor/ImageFactory.cs index 2497b1139..73ef61e74 100644 --- a/src/ImageProcessor/ImageFactory.cs +++ b/src/ImageProcessor/ImageFactory.cs @@ -21,7 +21,7 @@ namespace ImageProcessor using ImageProcessor.Common.Exceptions; using ImageProcessor.Imaging; using ImageProcessor.Imaging.Filters.EdgeDetection; - using ImageProcessor.Imaging.Filters.ObjectDetection; + //using ImageProcessor.Imaging.Filters.ObjectDetection; using ImageProcessor.Imaging.Filters.Photo; using ImageProcessor.Imaging.Formats; using ImageProcessor.Imaging.Helpers; @@ -512,16 +512,16 @@ namespace ImageProcessor return this; } - public ImageFactory DetectObjects(HaarCascade cascade, bool drawRectangles = true, Color color = default(Color)) - { - if (this.ShouldProcess) - { - DetectObjects detectObjects = new DetectObjects { DynamicParameter = cascade }; - this.CurrentImageFormat.ApplyProcessor(detectObjects.ProcessImage, this); - } + //public ImageFactory DetectObjects(HaarCascade cascade, bool drawRectangles = true, Color color = default(Color)) + //{ + // if (this.ShouldProcess) + // { + // DetectObjects detectObjects = new DetectObjects { DynamicParameter = cascade }; + // this.CurrentImageFormat.ApplyProcessor(detectObjects.ProcessImage, this); + // } - return this; - } + // return this; + //} /// /// Crops an image to the area of greatest entropy. diff --git a/src/ImageProcessor/ImageProcessor.csproj b/src/ImageProcessor/ImageProcessor.csproj index 958bcc7f4..e1a7814a9 100644 --- a/src/ImageProcessor/ImageProcessor.csproj +++ b/src/ImageProcessor/ImageProcessor.csproj @@ -162,21 +162,6 @@ Code - - - - - - - - - - - - - - - @@ -236,7 +221,6 @@ - @@ -274,12 +258,6 @@ - - - - - - \ No newline at end of file diff --git a/src/ImageProcessor/Imaging/FastBitmap.cs b/src/ImageProcessor/Imaging/FastBitmap.cs index 13cd1bc17..6df46aefb 100644 --- a/src/ImageProcessor/Imaging/FastBitmap.cs +++ b/src/ImageProcessor/Imaging/FastBitmap.cs @@ -236,7 +236,7 @@ namespace ImageProcessor.Imaging /// /// Gets the Integral Image for tilted values' sum. /// - public long[,] RotatedImage + public long[,] TiltedImage { get { return this.tiltedSumImage; } } diff --git a/src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs b/src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs index d9d57ac71..2f62e82ba 100644 --- a/src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs +++ b/src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs @@ -506,12 +506,10 @@ namespace ImageProcessor.Imaging.Quantizers { // Consume the next palette index this.paletteIndex = index++; - //int r = Math.Abs(this.red / this.pixelCount); - //int g = Math.Abs(this.green / this.pixelCount); - //int b = Math.Abs(this.blue / this.pixelCount); - int r = (this.red / this.pixelCount).ToByte(); - int g = (this.green / this.pixelCount).ToByte(); - int b = (this.blue / this.pixelCount).ToByte(); + + byte r = (this.red / this.pixelCount).ToByte(); + byte g = (this.green / this.pixelCount).ToByte(); + byte b = (this.blue / this.pixelCount).ToByte(); // And set the color of the palette entry palette.Add(Color.FromArgb(r, g, b));