Added a solution file, a new program file for my own projects, and renamed the tutorial files.
This commit is contained in:
1 parent
67650fce3e
commit
fe81bcc6b2
5 files changed
+69
No files matched your search
@@ -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
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<StartupObject>handToMouse.Program</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -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<Bgr, byte> convertFrame = frame.ToImage<Bgr, byte>();
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
Reference in new issue
Block a user