From 827f456a60fe87fa3347d026683f9e2e3484dc03 Mon Sep 17 00:00:00 2001 From: Swerik Date: Thu, 17 Sep 2020 14:54:12 +0200 Subject: [PATCH 1/2] update to Emgu.CV 4 (GPU now supported) --- RedEye.Backend/RedEye.Backend.csproj | 4 +-- RedEye.Backend/src/Util/EmguCvUtil.cs | 44 ++++++++++++--------------- RedEye.UI/RedEye.UI.csproj | 8 ++--- 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/RedEye.Backend/RedEye.Backend.csproj b/RedEye.Backend/RedEye.Backend.csproj index 2515fe4b..823ce87a 100644 --- a/RedEye.Backend/RedEye.Backend.csproj +++ b/RedEye.Backend/RedEye.Backend.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/RedEye.Backend/src/Util/EmguCvUtil.cs b/RedEye.Backend/src/Util/EmguCvUtil.cs index 8e60ba2a..d0f2518e 100644 --- a/RedEye.Backend/src/Util/EmguCvUtil.cs +++ b/RedEye.Backend/src/Util/EmguCvUtil.cs @@ -8,7 +8,6 @@ using Emgu.CV.Structure; using Emgu.CV.Util; using Emgu.Util; -using Emgu.Util.TypeEnum; namespace RedEye.Util { @@ -52,8 +51,8 @@ public static Bitmap RawDataToBitmap(IntPtr scan0, int step, Size size, Type src // See https://bugzilla.novell.com/show_bug.cgi?id=363431 if ( - Platform.OperationSystem == OS.Windows && - Platform.ClrType == ClrType.DotNet && + Platform.OperationSystem == Platform.OS.Windows && + Platform.ClrType == Platform.Clr.DotNet && srcColorType == typeof(Bgr) && srcDepthType == typeof(byte) && (step & 3) == 0) //Bgr byte @@ -184,7 +183,6 @@ public static Bitmap ToBitmap(this Mat mat) CvInvoke.GetDepthType(mat.Depth), true); } - /// /// Convert the umat into Bitmap, the pixel values are copied over to the Bitmap /// @@ -212,8 +210,8 @@ public static Bitmap ToBitmap(this GpuMat gpuMat) /// Create an Image < TColor, TDepth > from Bitmap /// public static Image ToImage(this Bitmap bitmap) where - TColor : struct, IColor - where TDepth : new() + TColor : struct, IColor + where TDepth : new() { var size = bitmap.Size; var image = new Image(size); @@ -408,17 +406,16 @@ public static Image ToImage(this Bitmap bitmap) return image; } - /// /// Utility function for converting Bitmap to Image /// /// the bitmap to copy data from /// The image to copy data to private static void CopyFromBitmap(this Image image, Bitmap bmp) where - TColor : struct - , IColor - where TDepth : - new() + TColor : struct + , IColor + where TDepth : + new() { var data = bmp.LockBits( new Rectangle(Point.Empty, bmp.Size), @@ -450,8 +447,8 @@ private static void CopyFromBitmap(this Image im /// Image<Bgra, Byte>, the image data is shared between the Bitmap and the Image object. /// public static Bitmap AsBitmap(this Image image) where - TColor : struct, IColor - where TDepth : new() + TColor : struct, IColor + where TDepth : new() { IntPtr scan0; int step; @@ -470,8 +467,8 @@ public static Bitmap AsBitmap(this Image image) /// /// This image in Bitmap format, the pixel data are copied over to the Bitmap public static Bitmap ToBitmap(this Image image) where - TColor : struct, IColor - where TDepth : new() + TColor : struct, IColor + where TDepth : new() { var typeOfColor = typeof(TColor); var typeofDepth = typeof(TDepth); @@ -524,12 +521,12 @@ public static Bitmap ToBitmap(this Image image) /// The height of the bitmap /// This image in Bitmap format of the specific size public static Bitmap ToBitmap(this Image image, int width, int height) where - TColor : - struct, - IColor - where - TDepth : - new() + TColor : + struct, + IColor + where + TDepth : + new() { using (var scaledImage = image.Resize(width, height, Inter.Linear)) { @@ -537,13 +534,12 @@ public static Bitmap ToBitmap(this Image image, } } - /// /// Convert the CudaImage to its equivalent Bitmap representation /// public static Bitmap ToBitmap(this CudaImage cudaImage) where - TColor : struct, IColor - where TDepth : new() + TColor : struct, IColor + where TDepth : new() { if (typeof(TColor) == typeof(Bgr) && typeof(TDepth) == typeof(byte)) { diff --git a/RedEye.UI/RedEye.UI.csproj b/RedEye.UI/RedEye.UI.csproj index c0192868..bb364e36 100644 --- a/RedEye.UI/RedEye.UI.csproj +++ b/RedEye.UI/RedEye.UI.csproj @@ -23,10 +23,10 @@ - - - - + + + + From 69b7662ef663b3d5e0f9708e0cecaee9a3f20a63 Mon Sep 17 00:00:00 2001 From: Swerik Date: Thu, 17 Sep 2020 14:54:47 +0200 Subject: [PATCH 2/2] update Version --- README.md | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0c5003b..a396b3cc 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ If you want to change any settings, then edit the `RedEye\config.csv` in your Do | `PickAverage` | Basically: It detects mutliple things as eyes and if you set this to true it will place the Meme-Texture over the average of every found eye location (I suggest `false`). `true \| false` | | `DrawRectangles` | Set if you want to draw rectangles over the areas where the program found your eyes (if you set this to `true`, then you probably want to lower `DetectionFrequency`). `true \| false` | | `Face` | Set wether you want to detect Faces (or Eyes). `true \| false` | -| `Cuda` | **DOESN'T WORK!** Set wether you want GPU acceleration. `true \| false` | +| `Cuda` | Set wether you want GPU acceleration. `true \| false` | | `ScreenshotLocation` | Set the Full-Path to a folder where you want your screenshots to be saved (Folder should exist). `Text \| default` | # Examples diff --git a/appveyor.yml b/appveyor.yml index f954e1f2..2e093ff9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ environment: - my_version_number: 1.4.1 # DONT FORGET TO CHANGE IS IN THE ISS FILE + my_version_number: 1.5.0 # DONT FORGET TO CHANGE IS IN THE ISS FILE application_name: RedEye # DONT FORGET TO CHANGE IS IN THE ISS FILE project_name: RedEye.UI