Files
DigitalImageProcessing/DIgitalImageProcessingImageSharp/Program.cs
T
2025-11-17 10:32:51 +08:00

33 lines
784 B
C#

using OpenCvSharp;
string[] testFiles = [
@"C:\Users\Surface\Downloads\1682575881230001.png", // 风景图
@"C:\Users\Surface\Downloads\Sprite-0001.png", // 二值图
@"C:\Users\Surface\Downloads\R-C.jfif", // 街道图
@"C:\Users\Surface\Downloads\OIP.webp" // 指纹图
];
string filepath = testFiles[3];
if (!ImageUtils.TryRead(filepath, out Mat image))
{
Console.WriteLine("Failed to read image: " + filepath);
return;
}
int thresholdValue = 128;
int thresholdDelta = 30;
Mat gray = new();
Cv2.CvtColor(image, gray, ColorConversionCodes.BGR2GRAY);
Mat img1 = new(), img2 = new();
float delta = float.MaxValue;
int loopCount = 0;
while(delta > thresholdValue)
{
//Cv2.Threshold(gray, img1, thresholdValue, 255, ThresholdTypes.Binary);
}