用OpenCVSharp (4.5)跑一遍 OpenCV 官方教程。
原 OpenCV 官方教程链接:OpenCV: Load Caffe framework models
using System;
using OpenCvSharp;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenCvSharp.Dnn;
using System.IO;
namespace ConsoleApp1
{
class tutorial57 : ITutorial
{
public void Run()
{
int rszWidth = 224;
int rszHeight = 244;
float scale = 1;
Scalar mean = new Scalar(104, 117, 123);
Scalar std = new Scalar(0.0, 0.0, 0.0);
bool swapRB = true;
bool crop = false;
int inpWidth = 224;
int inpHeight = 161;
string model = @"I:\csharp\images\caffe\bvlc_googlenet.caffemodel";
string config = @"I:\csharp\images\caffe\bvlc_googlenet.prototxt";

该博客展示了如何利用OpenCVSharp 4.5库在C#中执行OpenCV官方的Caffe模型,如bvlc_googlenet。代码详细解释了加载模型、预处理输入图像以及进行深度学习图像分类的过程。
最低0.47元/天 解锁文章
264





