From fe81bcc6b21295b262b171d5a1904900e3c75530 Mon Sep 17 00:00:00 2001 From: Carter Essen Date: Wed, 5 Aug 2026 22:11:12 -0400 Subject: [PATCH] Added a solution file, a new program file for my own projects, and renamed the tutorial files. --- Emgu.CV-Learning-Projects.sln | 14 +++++ Vision.csproj | 1 + src/program.cs | 54 +++++++++++++++++++ .../imageProcessors.cs | 0 .../program.cs | 0 5 files changed, 69 insertions(+) create mode 100644 Emgu.CV-Learning-Projects.sln create mode 100644 src/program.cs rename Display-Image.cs => tutorialMaterial/imageProcessors.cs (100%) rename Object-Detection.cs => tutorialMaterial/program.cs (100%) diff --git a/Emgu.CV-Learning-Projects.sln b/Emgu.CV-Learning-Projects.sln new file mode 100644 index 0000000..58ea566 --- /dev/null +++ b/Emgu.CV-Learning-Projects.sln @@ -0,0 +1,14 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Vision.csproj b/Vision.csproj index 6a5ba6b..6a8eae5 100644 --- a/Vision.csproj +++ b/Vision.csproj @@ -5,6 +5,7 @@ net9.0 enable enable + handToMouse.Program diff --git a/src/program.cs b/src/program.cs new file mode 100644 index 0000000..ec11298 --- /dev/null +++ b/src/program.cs @@ -0,0 +1,54 @@ +using System; +using Emgu.CV; +using Emgu.CV.Structure; + +namespace handToMouse +{ + class Program + { + static void Main(string[] args) + { + VideoCapture capture = new VideoCapture(); + Mat frame = new(); + bool pause = false; + + while(!pause) + { + capture.Read(frame); + + Image convertFrame = frame.ToImage(); + // Makes a greyscale image and the pixels that are in the range turn on and the rest are off. + var image = convertFrame.InRange(new Bgr(75, 0, 0), new Bgr(255, 190, 190)); + + // With these loops the program will look accros the rows ans colums for pixes in the rang + for (int i = 0; i < image.Rows; i++) + { + for (int j = 0; j < image.Cols; j++) + { + var intensity = image[i, j]; + + // Takes any pixels the loops find to be on and turns them blue + if (intensity.Intensity > 0) + { + convertFrame[i, j] = new Bgr(convertFrame[i, j].MCvScalar.V0 + 100, convertFrame[i, j].MCvScalar.V1 + 50, convertFrame[i, j].MCvScalar.V2 - 50); + } + // Takes all the pixels the loops find off and tuns them green + if (intensity.Intensity < 1) + { + convertFrame[i, j] = new Bgr(convertFrame[i, j].MCvScalar.V0 - 50, convertFrame[i, j].MCvScalar.V1 + 100, convertFrame[i, j].MCvScalar.V2 - 50); + } + } + } + Mat changedFrame = convertFrame.Mat; + + CvInvoke.Imshow("Video", changedFrame); + + int keyPressed = CvInvoke.WaitKey(1); + if (keyPressed == 27) + { + pause = true; + } + } + } + } +} \ No newline at end of file diff --git a/Display-Image.cs b/tutorialMaterial/imageProcessors.cs similarity index 100% rename from Display-Image.cs rename to tutorialMaterial/imageProcessors.cs diff --git a/Object-Detection.cs b/tutorialMaterial/program.cs similarity index 100% rename from Object-Detection.cs rename to tutorialMaterial/program.cs