91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-16
  • 語言: C/C++
  • 標(biāo)簽:

資源簡介

使用了opencv2411,檢測圖片的清晰度,色差,色偏,亮度。代碼在vs2013中直接可以運行

資源截圖

代碼片段和文件信息


#include?“stdafx.h“

#include?“opencv2/objdetect/objdetect.hpp“
#include?“opencv2/highgui/highgui.hpp“
#include?“opencv2/imgproc/imgproc.hpp“

#include?
#include?
#include
#include?
#include?

using?namespace?std;
using?namespace?cv;

/********************************************************************************?
*函數(shù)描述:??DefRto?計算并返回一幅圖像的清晰度????
*函數(shù)參數(shù):?frame??彩色幀圖?
*函數(shù)返回值:double???清晰度表示值,針對該視頻,大于20較好???????????
*********************************************************************************/??
double?DefRto(Mat?frame)??
{??
Mat?gray;??
cvtColor(framegrayCV_BGR2GRAY);??
IplImage?*img?=?&(IplImage(gray));??
double?temp?=?0;??
double?DR?=?0;??
int?ij;//循環(huán)變量??
int?height=img->height;??
int?width=img->width;??
int?step=img->widthStep/sizeof(uchar);??
uchar?*data=(uchar*)img->imageData;??
double?num?=?width*height;??

for(i=0;i {??
for(j=0;j {??
temp?+=?sqrt((pow((double)(data[(i+1)*step+j]-data[i*step+j])2)?+?pow((double)(data[i*step+j+1]-data[i*step+j])2)));??
temp?+=?abs(data[(i+1)*step+j]-data[i*step+j])+abs(data[i*step+j+1]-data[i*step+j]);??
}??
}??
DR?=?temp/num;??
return?DR;??
}??



/********************************************************************************************?
*函數(shù)描述:??calcCast????計算并返回一幅圖像的色偏度以及,色偏方向????
*函數(shù)參數(shù):??InputImg????需要計算的圖片,BGR存放格式,彩色(3通道),灰度圖無效?
*???????????cast????????計算出的偏差值,小于1表示比較正常,大于1表示存在色偏?
*???????????da??????????紅/綠色偏估計值,da大于0,表示偏紅;da小于0表示偏綠?
*???????????db??????????黃/藍(lán)色偏估計值,db大于0,表示偏黃;db小于0表示偏藍(lán)?
*函數(shù)返回值:?返回值通過cast、da、db三個應(yīng)用返回,無顯式返回值?
*********************************************************************************************/??
void?colorException(Mat?InputImgfloat&?castfloat&?dafloat&?db)??
{??
Mat?LABimg;??
cvtColor(InputImgLABimgCV_BGR2Lab);//參考http://blog.csdn.net/laviewpbt/article/details/9335767??
//由于OpenCV定義的格式是uint8,這里輸出的LABimg從標(biāo)準(zhǔn)的0~100,-127~127,-127~127,被映射到了0~255,0~255,0~255空間??
float?a=0b=0;??
int?HistA[256]HistB[256];??
for(int?i=0;i<256;i++)??
{??
HistA[i]=0;??
HistB[i]=0;??
}??
for(int?i=0;i {??
for(int?j=0;j {??
a+=float(LABimg.at(ij)[1]-128);//在計算過程中,要考慮將CIE?L*a*b*空間還原?后同??
b+=float(LABimg.at(ij)[2]-128);??
int

評論

共有 條評論

相關(guān)資源