Initial commit with four projects done.

This commit is contained in:
Carter committed 2026-08-02 22:29:12 -04:00
commit 4a46119095
66 files changed
+2832

No files matched your search

+103
View File
@@ -0,0 +1,103 @@
using System;
using Emgu.CV;
using Emgu.CV.Structure;
namespace ImageMinipulation {
public class vanGoghFilters
{
/// <summary>
/// Displays an image in a window and displays the same image but bluerd in a new window
/// </summary>
public void One()
{
Mat pic = new Mat();
Mat gaussianBlur = new Mat();
pic = CvInvoke.Imread("./img/StarryNight.jpg");
CvInvoke.GaussianBlur(pic, gaussianBlur, new System.Drawing.Size(15, 15), 5.0);
CvInvoke.Imshow("starry night", pic);
CvInvoke.Imshow("blurry night", gaussianBlur);
CvInvoke.WaitKey();
}
/// <summary>
/// Resizes and image to a predetermined amount
/// </summary>
public void Two()
{
Mat pic = CvInvoke.Imread("./img/StarryNight.jpg");
Mat resizedPic = new Mat();
int height = pic.Rows;
int width = pic.Cols;
Console.WriteLine($"Starry Night is : {width} x {height}");
CvInvoke.Resize(pic, resizedPic, new System.Drawing.Size(400, 500));
CvInvoke.Imshow("Starry Night", pic);
CvInvoke.Imshow("resized Night", resizedPic);
CvInvoke.WaitKey();
}
/// <summary>
/// Rotates an image around the center 45 degrees
/// </summary>
public void Three()
{
Mat pic = CvInvoke.Imread("./img/StarryNight.jpg");
Mat rotatedPic = new Mat();
double angleFortyFive = 45;
int width = pic.Cols;
int height = pic.Rows;
System.Drawing.PointF center = new System.Drawing.PointF((width - 1) / 2.0f, (height - 1) / 2.0f);
Mat rotationMatrix = new Mat();
CvInvoke.GetRotationMatrix2D(center, angleFortyFive, 1.0, rotationMatrix);
CvInvoke.WarpAffine(pic, rotatedPic, rotationMatrix, new System.Drawing.Size(width, height));
CvInvoke.Imshow("Rotated Night", rotatedPic);
CvInvoke.WaitKey();
}
/// <summary>
///
/// </summary>
public void Four()
{
Mat pic = CvInvoke.Imread("./img/StarryNight.jpg");
Image<Bgr, byte> convertPic = pic.ToImage<Bgr, byte>();
int width = pic.Cols;
int height = pic.Rows;
var image = convertPic.InRange(new Bgr(75, 0, 0), new Bgr(255, 0, 0));
for (int i = 0; i < image.Rows; i++)
{
for (int j = 0; j < image.Cols; j++)
{
var num = image[i, j];
if (num.Intensity > 0)
{
convertPic[i, j] = new Bgr(convertPic[i, j].MCvScalar.V0 - 50, convertPic[i, j].MCvScalar.V1 - 50, convertPic[i, j].MCvScalar.V2 + 100);
}
}
}
Mat changedPic = convertPic.Mat;
CvInvoke.Imshow("Starry Night", pic);
CvInvoke.Imshow("Color-Shifted Night", changedPic);
CvInvoke.WaitKey();
}
}
}