1103
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.11.0.20250507" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,40 @@
|
||||
using OpenCvSharp;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
//string filepath = (@"C:\Users\Surface\Downloads\" + @"1682575881230001.png");
|
||||
|
||||
int year = 2025;
|
||||
bool isLeap1 = DateTime.IsLeapYear(year);
|
||||
bool isLeap2 = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
|
||||
bool isLeap3 = year switch
|
||||
{
|
||||
_ when year % 400 == 0 => true,
|
||||
_ when year % 100 == 0 => false,
|
||||
_ when year % 4 == 0 => true,
|
||||
_ => false,
|
||||
};
|
||||
bool isLeap4 = year % 4 == 0 ? (year % 100 == 0 ? (year % 400 == 0 ? true : false) : true) : false;
|
||||
bool isLeap5 = year % 4 != 0 ? false : year % 100 != 0 ? true : year % 400 == 0 ? true : false;
|
||||
|
||||
Console.WriteLine(isLeap1);
|
||||
Console.WriteLine(isLeap2);
|
||||
Console.WriteLine(isLeap3);
|
||||
Console.WriteLine(isLeap4);
|
||||
Console.WriteLine(isLeap5);
|
||||
|
||||
string filepath = (@"C:\Users\Surface\Downloads\" + @"sprite-0001.png");
|
||||
|
||||
Mat image = Cv2.ImRead(filepath);
|
||||
InputArray kernel = InputArray.Create<int>(new int[,] {
|
||||
{ 0, 1, 0 },
|
||||
{ 1, 1, 1 },
|
||||
{ 0, 1, 0 }
|
||||
}, MatType.CV_8U);
|
||||
Mat dst = new();
|
||||
//Cv2.Filter2D(image, dst, image.Depth(), kernel);
|
||||
|
||||
Cv2.Dilate(image, dst, kernel);
|
||||
|
||||
dst = dst - image;
|
||||
|
||||
dst.ImWrite(@"C:\Users\Surface\Downloads\" + @"filtered_opencv.png");
|
||||
Reference in New Issue
Block a user