#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
opencv 基于内容的视频关键帧提取(以HSV总量为特征量)
最新推荐文章于 2024-05-30 10:37:52 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)