Browse Source

Hiding object detection for now.

Former-commit-id: c909fa7642dd268ae0fdea05e115a6156c4fc3f0
Former-commit-id: 69ab4af6853b6f8cf4b1aecbb31851c71a73c771
Former-commit-id: 33abf27816345bf05d12e8f74f28228fa59cef66
pull/17/head
James South 11 years ago
parent
commit
b2ed1ed32a
  1. 20
      src/ImageProcessor.Playground/Program.cs
  2. 20
      src/ImageProcessor/ImageFactory.cs
  3. 22
      src/ImageProcessor/ImageProcessor.csproj
  4. 2
      src/ImageProcessor/Imaging/FastBitmap.cs
  5. 10
      src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs

20
src/ImageProcessor.Playground/Program.cs

@ -21,7 +21,7 @@ namespace ImageProcessor.PlayGround
using ImageProcessor.Configuration; using ImageProcessor.Configuration;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
using ImageProcessor.Imaging.Filters.EdgeDetection; using ImageProcessor.Imaging.Filters.EdgeDetection;
using ImageProcessor.Imaging.Filters.ObjectDetection; //using ImageProcessor.Imaging.Filters.ObjectDetection;
using ImageProcessor.Imaging.Filters.Photo; using ImageProcessor.Imaging.Filters.Photo;
using ImageProcessor.Imaging.Formats; using ImageProcessor.Imaging.Formats;
using ImageProcessor.Processors; 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-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, "gamma_dalai_lama_gray.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Arc-de-Triomphe-France.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, "Martin-Schoeller-Jack-Nicholson-Portrait.jpeg"));
FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "test2.png")); //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, "crop-base-300x200.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "cmyk.png")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "cmyk.png"));
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif"); //IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif");
IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".png", ".jpg", ".jpeg"); //IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".png", ".jpg", ".jpeg");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".jpg", ".jpeg", ".jfif"); //IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".jpg", ".jpeg", ".jfif");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png"); //IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png");
@ -88,7 +90,7 @@ namespace ImageProcessor.PlayGround
{ {
using (ImageFactory imageFactory = new ImageFactory(true, false)) 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); //CropLayer cropLayer = new CropLayer(20, 20, 20, 20, ImageProcessor.Imaging.CropMode.Percentage);
//ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false); //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. // Load, resize, set the format and quality and save an image.
imageFactory.Load(inStream) imageFactory.Load(inStream)
.DetectObjects(EmbeddedHaarCascades.FrontFaceDefault) //.DetectObjects(EmbeddedHaarCascades.FrontFaceDefault)
//.Overlay(new ImageLayer //.Overlay(new ImageLayer
// { // {
// Image = overlay, // Image = overlay,
@ -113,7 +115,9 @@ namespace ImageProcessor.PlayGround
//.Format(new PngFormat()) //.Format(new PngFormat())
//.BackgroundColor(Color.Cyan) //.BackgroundColor(Color.Cyan)
//.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128) //.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.Max))
// .Resize(new ResizeLayer(size, ResizeMode.Stretch)) // .Resize(new ResizeLayer(size, ResizeMode.Stretch))
//.DetectEdges(new Laplacian3X3EdgeFilter(), true) //.DetectEdges(new Laplacian3X3EdgeFilter(), true)

20
src/ImageProcessor/ImageFactory.cs

@ -21,7 +21,7 @@ namespace ImageProcessor
using ImageProcessor.Common.Exceptions; using ImageProcessor.Common.Exceptions;
using ImageProcessor.Imaging; using ImageProcessor.Imaging;
using ImageProcessor.Imaging.Filters.EdgeDetection; using ImageProcessor.Imaging.Filters.EdgeDetection;
using ImageProcessor.Imaging.Filters.ObjectDetection; //using ImageProcessor.Imaging.Filters.ObjectDetection;
using ImageProcessor.Imaging.Filters.Photo; using ImageProcessor.Imaging.Filters.Photo;
using ImageProcessor.Imaging.Formats; using ImageProcessor.Imaging.Formats;
using ImageProcessor.Imaging.Helpers; using ImageProcessor.Imaging.Helpers;
@ -512,16 +512,16 @@ namespace ImageProcessor
return this; return this;
} }
public ImageFactory DetectObjects(HaarCascade cascade, bool drawRectangles = true, Color color = default(Color)) //public ImageFactory DetectObjects(HaarCascade cascade, bool drawRectangles = true, Color color = default(Color))
{ //{
if (this.ShouldProcess) // if (this.ShouldProcess)
{ // {
DetectObjects detectObjects = new DetectObjects { DynamicParameter = cascade }; // DetectObjects detectObjects = new DetectObjects { DynamicParameter = cascade };
this.CurrentImageFormat.ApplyProcessor(detectObjects.ProcessImage, this); // this.CurrentImageFormat.ApplyProcessor(detectObjects.ProcessImage, this);
} // }
return this; // return this;
} //}
/// <summary> /// <summary>
/// Crops an image to the area of greatest entropy. /// Crops an image to the area of greatest entropy.

22
src/ImageProcessor/ImageProcessor.csproj

@ -162,21 +162,6 @@
<Compile Include="Imaging\FastBitmap.cs"> <Compile Include="Imaging\FastBitmap.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Imaging\Filters\ObjectDetection\Class1.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\EmbeddedHaarCascades.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\GroupMatching.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarCascade.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarCascadeSerializationObject.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarCascadeStage.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarCascadeWriter.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarClassifier.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarFeature.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarFeatureNode.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarCascade\HaarRectangle.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\HaarObjectDetector.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\ObjectDetectorScalingMode.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\ObjectDetectorSearchMode.cs" />
<Compile Include="Imaging\Filters\ObjectDetection\RectangleGroupMatching.cs" />
<Compile Include="Imaging\Formats\GifDecoder.cs" /> <Compile Include="Imaging\Formats\GifDecoder.cs" />
<Compile Include="Common\Extensions\IntegerExtensions.cs" /> <Compile Include="Common\Extensions\IntegerExtensions.cs" />
<Compile Include="Common\Exceptions\ImageFormatException.cs" /> <Compile Include="Common\Exceptions\ImageFormatException.cs" />
@ -236,7 +221,6 @@
<Compile Include="Imaging\Resizer.cs" /> <Compile Include="Imaging\Resizer.cs" />
<Compile Include="Imaging\RoundedCornerLayer.cs" /> <Compile Include="Imaging\RoundedCornerLayer.cs" />
<Compile Include="Imaging\TextLayer.cs" /> <Compile Include="Imaging\TextLayer.cs" />
<Compile Include="Processors\DetectObjects.cs" />
<Compile Include="Processors\Gamma.cs" /> <Compile Include="Processors\Gamma.cs" />
<Compile Include="Processors\Alpha.cs" /> <Compile Include="Processors\Alpha.cs" />
<Compile Include="Processors\EntropyCrop.cs" /> <Compile Include="Processors\EntropyCrop.cs" />
@ -274,12 +258,6 @@
<ItemGroup> <ItemGroup>
<WCFMetadata Include="Service References\" /> <WCFMetadata Include="Service References\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Imaging\Filters\ObjectDetection\Resources\haarcascade_frontalface_default.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Imaging\Filters\ObjectDetection\Resources\haarcascade_frontalface_legacy.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</Project> </Project>

2
src/ImageProcessor/Imaging/FastBitmap.cs

@ -236,7 +236,7 @@ namespace ImageProcessor.Imaging
/// <summary> /// <summary>
/// Gets the Integral Image for tilted values' sum. /// Gets the Integral Image for tilted values' sum.
/// </summary> /// </summary>
public long[,] RotatedImage public long[,] TiltedImage
{ {
get { return this.tiltedSumImage; } get { return this.tiltedSumImage; }
} }

10
src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs

@ -506,12 +506,10 @@ namespace ImageProcessor.Imaging.Quantizers
{ {
// Consume the next palette index // Consume the next palette index
this.paletteIndex = index++; this.paletteIndex = index++;
//int r = Math.Abs(this.red / this.pixelCount);
//int g = Math.Abs(this.green / this.pixelCount); byte r = (this.red / this.pixelCount).ToByte();
//int b = Math.Abs(this.blue / this.pixelCount); byte g = (this.green / this.pixelCount).ToByte();
int r = (this.red / this.pixelCount).ToByte(); byte b = (this.blue / this.pixelCount).ToByte();
int g = (this.green / this.pixelCount).ToByte();
int b = (this.blue / this.pixelCount).ToByte();
// And set the color of the palette entry // And set the color of the palette entry
palette.Add(Color.FromArgb(r, g, b)); palette.Add(Color.FromArgb(r, g, b));

Loading…
Cancel
Save