New sharpen filter and a new option to select the filter
This commit is contained in:
1 parent
6a07ba666b
commit
afd3972c6f
2 files changed
+45
-4
No files matched your search
@@ -23,6 +23,10 @@ namespace VideoProcessor
|
||||
Filters edges = new Filters();
|
||||
edges.Edges();
|
||||
break;
|
||||
case "sharpen":
|
||||
Filters sharpen = new Filters();
|
||||
sharpen.Sharpen();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
||||
+41
-4
@@ -8,11 +8,12 @@ namespace VideoProcessor
|
||||
class Filters
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// Creates a grey scale image and every pixel with a vule inside a range is changed to blue and
|
||||
/// every other pixel is changed to green
|
||||
/// </summary>
|
||||
public void ColorSwap()
|
||||
{
|
||||
VideoCapture capture = new VideoCapture();
|
||||
VideoCapture capture = new VideoCapture(0);
|
||||
Mat frame = new();
|
||||
bool pause = false;
|
||||
|
||||
@@ -56,11 +57,11 @@ namespace VideoProcessor
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Uses canny edge ditection to find and display all the edges in a frame
|
||||
/// </summary>
|
||||
public void Edges()
|
||||
{
|
||||
VideoCapture capture = new VideoCapture();
|
||||
VideoCapture capture = new VideoCapture(0);
|
||||
Mat feed = new Mat();
|
||||
Mat guassianBlur = new Mat();
|
||||
Mat cannyFeed = new Mat();
|
||||
@@ -87,5 +88,41 @@ namespace VideoProcessor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Sharpen()
|
||||
{
|
||||
VideoCapture capture = new();
|
||||
Mat feed = new();
|
||||
Mat sharpendFeed = new();
|
||||
|
||||
bool play = false;
|
||||
|
||||
float[,] kernalArray = new float[3, 3]
|
||||
{
|
||||
{ 0, -1, 0},
|
||||
{ -1, 5, -1},
|
||||
{ 0, -1, 0}
|
||||
};
|
||||
|
||||
ConvolutionKernelF kernal = new ConvolutionKernelF(kernalArray);
|
||||
|
||||
while(!play)
|
||||
{
|
||||
capture.Read(feed);
|
||||
|
||||
CvInvoke.Filter2D(feed, sharpendFeed, kernal, new Point(0, 0));
|
||||
|
||||
CvInvoke.Imshow("Sharpend Video", sharpendFeed);
|
||||
|
||||
int keyPressed = CvInvoke.WaitKey(1);
|
||||
if (keyPressed == 27)
|
||||
{
|
||||
play = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user