You can find a sample project for this plugin in \Samples\ImageStudio
within the full download
Provides automatic and manual red-eye detection and correction. For automatic face and eye detection, OpenCV is required. Requires V3.2 or higher.
A NuGet package for this plugin is not available, due to the vast number of dependencies.
OpenCV does not support being used from multiple app domains. If you get a "Type Initializer Exception", restart the application pool and verify that it only contains 1 application, and that overlapped recycle is disabled.
You must disable overlapped recycling on the application pool running this plugin. OpenCV cannot handle multiple instances per plugin.
Usage
- r.autoeyes=true
- r.eyes=x1,y1,x2,y2,a,x1,y1,x2,y2,a,… (groups of 5 coordinates, the fifth of which is the accuracy value)
- r.filter=2
- r.detecteyes=true - Responds with a JSON result. See the Faces plugin documentation for details.
- r.getlayout=true - Responds with image layout info in JSON. See the Faces plugin documentation for details.
Installation.
- Add ImageResizer.Plugins.RedEye.dll to your project using Visual Studio. If you copy & paste to /bin, you'll need to also copy the files listed under Managed Dependencies.
- Add
<add name="RedEye" downloadNativeDependencies="true" />
inside<resizer><plugins></plugins></resizer>
in Web.config. - If you're not comfortable allowing the plugin to automatically download the correct bitness versions of the unmanaged dependencies, then set downloadNativeDependencies="false" and keep reading.
- Manually copy the required xml files to the /bin folder of your application (see Feature classification files)
- Manually copy all required dlls to the /bin folder of your application. (see Using the 2.3.1 pre-compiled binaries)
Managed Dependencies
- ImageResizer.dll
- ImageResizer.Plugin.Faces.dll
- AForge.dll
- AForge.Math.dll
- AForge.Imaging.dll
- AForge.Imaging.Formats.dll
- OpenCvSharp.dll
- OpenCvSharp.dll.config
- Newtonsoft.Json.dll
Feature classification files
You can download all the XML files in a single .ZIP file. You only need to copy the following into the /bin folder.
- haarcascade_frontalface_default.xml
- haarcascade_mcs_lefteye.xml
- haarcascade_mcs_righteye.xml
- haarcascade_mcs_eyepair_big.xml
- haarcascade_mcs_eyepair_small.xml
Using the 2.3.1 pre-compiled binaries
All dlls must match in bitness. All dlls are bitness specific. You can't run OpenCV x86 on an x64 app pool or vice versa.
Manually getting the binaries
The provided binaries are for OpenCV 2.3.1. If a newer version is released, you can get it yourself.
- Download either the x86 or x64 build of OpenCvSharp.
- Extract to a folder, and copy OpenCvSharp.dll and OpenCvSharp.dll.config. The x86 and x64 builds are actually identical.
- Go to SourceForge, the opencvlibrary project, the Files section, the opencv-win folder [Link].
- Select the latest version and download the OpenCV-[Version]-win-superpack.exe file.
- Extract it somewhere (you'll want to delete it later, it's over 1GB uncompressed)
Files to copy from extracted OpenCV-2.3.1-win-superpack package
- tbb.dll (From opencv\build\common\tbb\ia32\vc9 or opencv\build\common\tbb\intel64\vc9
- opencv_calib3d231.dll (From opencv\build\x64\vc9\bin or opencv\build\x86\vc9\bin)
- opencv_core231.dll
- opencv_features2d231.dll
- opencv_flann231.dll
- opencv_gpu231.dll
- opencv_highgui231.dll
- opencv_imgproc231.dll
- opencv_legacy231.dll
- opencv_ml231.dll
- opencv_objdetect231.dll
- opencv_ts231.dll
This plugin (RedEye plugin) is part of the Elite Edition
Where is the plugins section?
The <plugins>
section is located in Web.config, and is nested inside the <resizer>
element, which is nested inside <configuration>
. For examples, see this sample Web.config file.
Where can I find the dll?
We prefer that you install via NuGet, but you can also find the plugin DLL files in the /dlls/release folder of your download.
How do I typically install a plugin via Web.Config?
- In Visual Studio, right click on your project and choose "Add reference". Browse to the plugin DLL and click "OK".
- In the <plugins> section of Web.config, insert <add name="PluginName" />
- Look at the plugin documentation to see what configuration options (if any) are available.