最近根据开源的项目,进行优化,实现,脸部处理的效果,开发环境:vs2022 + openCVsharp4.8 +Microsoft.ML.OnnxRuntime.GPU 1.18版本

在源代码的基础上进行了优化,增加了音频处理,gpu的优化功能有
public partial class VideoGpu : Form
{
private VideoAudioProcessor _videoAudioProcessor;
private readonly string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
private VideoAudioProcessor processor = new VideoAudioProcessor();
private CancellationTokenSource cts;
public VideoGpu()
{
InitializeComponent();
this.Load += new EventHandler(Form1_Load);
_videoAudioProcessor = new VideoAudioProcessor();
}
string fileFilter = "图片|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
string startupPath = string.Empty;
string source_path = string.Empty;
string newVideoPath = string.Empty;
string finalOutputPath = string.Empty;
Yolov8Face detect_face;
Face68Landmarks detect_68landmarks;
FaceEmbdding face_embedding;
SwapFace swap_face;
FaceEnhance enhance_face;
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = fileFilter;
if (ofd.ShowDialog() != DialogResult.OK) return;
pictureBox1.Image = null;
source_path = ofd.FileName;
pictureBox1.Image = new Bitmap(source_path);
}
string video_path = "";
string videoFilter = "视频|*.mp4;*.avi;";
private void button3_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = videoFilter;
ofd.InitialDirectory = Application.StartupPath + "\\test";
if (ofd.ShowDialog() != DialogResult.OK) return;
video_path = ofd.FileName;
label2.Text = video_path;
//读取第一帧显示
VideoCapture vcapture = new VideoCapture(video_path);
if (!vcapture.IsOpened(

最低0.47元/天 解锁文章
1801

被折叠的 条评论
为什么被折叠?



