模型和测试文件:https://wwu.lanzoub.com/i1BJx01rr38h
c++的demo网上到处都有,抄一个C#的demo
因为没有视频,换了张图片把代码改成识别图片了,自己根据需要切换注释
using OpenCvSharp;
using OpenCvSharp.Dnn;
using System;
public class dnn_ssd_video_mobilenet
{
const int width = 300;
const int height = 300;
const float meanVal = 127.5f;
const float scaleFactor = 0.007843f;
string[] classNames = new string[] { "background",
"aeroplane", "bicycle", "bird", "boat",
"bottle", "bus", "car", "cat", "chair",
"cow", "diningtable", "dog", "horse",
"motorbike", "person", "pottedplant",
"sheep", "sofa", "train", "tvmonitor" };
String modelFile = "G:/SourceCode/MobileNetSSD_deploy.caffemodel";
String model_text_file = "G:/SourceCode/MobileNetSSD_deploy.prototxt";
string srcPath = @"G:\images\";
public void Run()
{

这篇博客介绍了如何在C#环境中利用OpenCVSharp库结合MobileNetSSD模型进行物体识别。作者提供了模型和测试文件的下载链接,并分享了一个C# demo代码,将原本用于视频的代码修改为适用于图像识别。此外,还给出了学习资源和配套的C++教程以及视频教程链接,帮助读者深入理解物体检测的实现过程。
最低0.47元/天 解锁文章
676





