Added the the fith style type, Convolution kernals
This commit is contained in:
1 parent
4a46119095
commit
d61330e177
20 files changed
+107
-20
No files matched your search
+34
-3
@@ -67,7 +67,7 @@ namespace ImageMinipulation {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Changing the color of pixels inside a range to new colors
|
||||
/// </summary>
|
||||
public void Four()
|
||||
{
|
||||
@@ -77,7 +77,7 @@ namespace ImageMinipulation {
|
||||
int width = pic.Cols;
|
||||
int height = pic.Rows;
|
||||
|
||||
var image = convertPic.InRange(new Bgr(75, 0, 0), new Bgr(255, 0, 0));
|
||||
var image = convertPic.InRange(new Bgr(75, 0, 0), new Bgr(255, 125, 125));
|
||||
|
||||
for (int i = 0; i < image.Rows; i++)
|
||||
{
|
||||
@@ -87,7 +87,7 @@ namespace ImageMinipulation {
|
||||
|
||||
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);
|
||||
convertPic[i, j] = new Bgr(convertPic[i, j].MCvScalar.V0 - 50, convertPic[i, j].MCvScalar.V1 + 100, convertPic[i, j].MCvScalar.V2 - 50);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -99,5 +99,36 @@ namespace ImageMinipulation {
|
||||
|
||||
CvInvoke.WaitKey();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Five()
|
||||
{
|
||||
Mat pic = CvInvoke.Imread("./img/StarryNight.jpg");
|
||||
|
||||
/// This is a 3D matrix, and we will be using a process called convoluion
|
||||
/// Convolution is the application of a kernel to each individual pixal and it's surrounding pixels
|
||||
/// then you take that value and put it back in the pixel and some effect happens depending on the valuse
|
||||
/// in the kernel
|
||||
/// A new convoluted kernal can be looked up for the effect you want (this kernal is basic sharpen)
|
||||
float[,] kernalArray = new float[3, 3]
|
||||
{
|
||||
{ 0, -1, 0},
|
||||
{ -1, 5, -1},
|
||||
{ 0, -1, 0}
|
||||
};
|
||||
|
||||
ConvolutionKernelF kernal = new ConvolutionKernelF(kernalArray);
|
||||
|
||||
Mat filteredPic = new Mat();
|
||||
pic.CopyTo(filteredPic);
|
||||
|
||||
CvInvoke.Filter2D(pic, filteredPic, kernal, new System.Drawing.Point(0, 0));
|
||||
|
||||
CvInvoke.Imshow("Convoluted Night", filteredPic);
|
||||
|
||||
CvInvoke.WaitKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user