#include "stdafx.h"
#include
#include "opencv2/core/core.hpp"
#include
#include
using namespace std;
using namespace cv;
void RGBtoHSV(float b,float g,float r,float &h,float &s,float &v)//将RGB值转化为HSV值
{
float max = (((r > b) ? r : b) > g) ? ((r > b) ? r : b) : g ;
float min = (((r > b) ? b : r) > g) ? g : ((r > b) ? b : r);
if (max == min)
{
h = 0; s = 0; v = max / 255;
}
else if (g >= b)
{
h = (max - r + g - min + b - min) / (max - min) * 60;
s = 1 - min / max;
v = max / 255;
}
else if (g < b)
{
h = 360 - (max - r + g - min + b - min) / (max - min) * 60;
s = 1 - min / max;
v = max / 255;
}
}
//以HSV总量作为特征量提取关键帧
int HSV(Mat img)
{
// IplImage * ipl_img = NULL;
// * ipl_img =img;//将Mat类型转化为IplImage
float B, G, R, H=0, S=0, V=0;
int nr = img.rows; // number of rows
int nc = img.cols; // number of cols
float sumH = 0, sumS = 0, sumV = 0;
CvScalar cs;
//将Mat类型转化为IplImage
I
opencv 基于内容的视频关键帧提取(以HSV总量为特征量)
最新推荐文章于 2022-05-07 22:20:17 发布