cafe-opencv.docx


立即下载 ⑩Ⅵ嵗D夨憶
2024-04-19
Mat preprocessed const include
17 KB

#include "stdafx.h"
#include
#include
#include
using namespace cv;
using namespace cv::dnn;
#include
#include
#include
using namespace std;
const size_t width = 256;
const size_t height = 256;
Mat getMean(const size_t& imageHeight, const size_t& imageWidth)
{
Mat mean;
const int meanValues[3] = { 104, 117, 123 };
vector meanChannels;
for (size_t i = 0; i < 3; i++)
{
Mat channel(imageHeight, imageWidth, CV_32F, Scalar(meanValues[i]));
meanChannels.push_back(channel);
}
cv::merge(meanChannels, mean);
return mean;
}
Mat preprocess(const Mat& frame)
{
Mat preprocessed;
frame.convertTo(preprocessed, CV_32FC3);
resize(preprocessed, preprocessed, Size(width, height)); //SSD accepts 300x300 RGB-images
Mat mean = getMean(width, height);
cv::subtract(preprocessed, mean, preprocessed);
return preprocessed;
}
const char* about = "This sample uses Single-Shot Detector"
"to det


Mat/preprocessed/const/include/ Mat/preprocessed/const/include/
-1 条回复
登录 后才能参与评论
-->