目录
效果
项目
代码
下载
效果
项目
代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
服务器托管网using System.Linq;
using System.Text;
using System.Windows.Forms;
using OpenCvSharp;
using OpenCvSharp.Dnn;
using OpenCvSharp.Extensions;
namespace OpenCvSharp_DNN_二维码增强
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
Bitmap bmp;
String imgPath = "";
const string prototxt_path = "sr.prototxt服务器托管网";
const string caffe_model_path = "sr.caffemodel";
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = fileFilter;
if (ofd.ShowDialog() != DialogResult.OK) return;
imgPath = ofd.FileName;
bmp = new Bitmap(imgPath);
pictureBox1.Image = bmp;
}
private void button1_Click(object sender, EventArgs e)
{
if (pictureBox1.Image == null)
{
return;
}
var src = Cv2.ImRead(imgPath, ImreadModes.Grayscale);
var srnet = CvDnn.ReadNetFromCaffe(prototxt_path, caffe_model_path);
Mat blob = CvDnn.BlobFromImage(src, 1.0 / 255, src.Size(), new Scalar(0.0f), false, false);
srnet.SetInput(blob);
var prob = srnet.Forward();
var dst = new Mat(prob.Size(2), prob.Size(3), MatType.CV_8UC1);
for (int row = 0; row (0, 0, row, col) * 255;
dst.Set(row, col, (byte)(Math.Max(0, Math.Min(pixel, 255f))));
}
}
pictureBox2.Image = BitmapConverter.ToBitmap(dst);
// Cv2.ImShow("src", src);
// Cv2.ImShow("dst", dst);
}
}
}
下载
Demo下载
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
相关推荐: ChatGPT高效提问—prompt常见用法(续篇七)
ChatGPT高效提问—prompt常见用法(续篇七) 1.1 零样本、单样本和多样本 ChatGPT拥有令人惊叹的功能和能力,允许用户自由向其提问,无须提供任何具体的示例样本,就可以获得精准的回答。这种特性被称为零样本(zero shot)prompt。…