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

資源簡介

用傳統方法識別數碼管,思想是三次掃描數碼管,得到一個編碼值,然后去匹配。

資源截圖

代碼片段和文件信息

#include?
#include?

#include?“svm.h“

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

////ROI區域開始結束點
//Point?g_start(310?315);
//Point?g_end(1033?525);

//ROI區域開始結束點
Point?g_start(181?420);
Point?g_end(838?580);

//二值化閾值
int?my_threshold?=?65;


void?on_Trackbar(int?void*)
{
;
}

//2?3?4?5?6?7?8?9?0
static?unsigned?char?model_num2[9]?=?{?0x5b?0x4f?0x66?0x6d?0x7d?0x27?0x7f?0x6f?0x3f?};

int?match_num(Mat?&img)
{
//????????6?5?4?3?2?1?0
//2?0x5b??1?0?1?1?0?1?1
//3?0x4f??1?0?0?1?1?1?1
//4?0x66??1?1?0?0?1?1?0
//5?0x6d??1?1?0?1?1?0?1
//6?0x7d??1?1?1?1?1?0?1
//7?0x27??0?1?0?0?1?1?1?0x07?0?0?0?0?1?1?1
//8?0x7f??1?1?1?1?1?1?1
//9?0x6f??1?1?0?1?1?1?1
//0?0x3f??0?1?1?1?1?1?1

////2?3?4?5?6?7?8?9?0
//unsigned?char?model_num2[9]?=?{?0x5b?0x4f?0x66?0x6d?0x7d?0x27?0x7f?0x6f?0x3f?};

Mat?img_temp?=?img.clone();
/*
---------------------00000-------------------------
--------------------5-----1------------------------
--------------------5-----1------------------------
---------------------66666-------------------------
--------------------4-----2------------------------
--------------------4-----2------------------------
---------------------33333-------------------------
*/
rectangle(img_temp?Rect(0?0?img_temp.cols?img_temp.rows)?Scalar(0)?1); //處理邊界

int?y1?=?img_temp.rows?>>?2;??????//y方向1/4處
int?y2?=?(img_temp.rows?>>?2)?*?3;; //y方向3/4處
int?xx?=?img_temp.cols?>>?1; ?//x方向1/2處
int?yy?=?img_temp.rows?>>?1; ?//x方向1/2處

unsigned?char?temp_value?=?0;

//識別到1
if?((double)img.rows?/?(double)img.cols?>?2.5)
return?1;


//兩條橫線檢測遍歷
for?(int?y?=?y1;?y? {
uchar?*pp?=?img_temp.ptr(y);
for?(int?x?=?0;?x? {
if?(pp[x]?==?0)
{
if?(pp[x?+?1]?==?255)
{
if?(x? if?(x?>?xx?&&?y? if?(x??yy)?temp_value?|=?(0x01?< if?(x?>?xx?&&?y?>?yy)?temp_value?|=?(0x01?< }
}
}
}
//一條豎線檢測遍歷
for?(int?y?=?0;?y? {
uchar?*pp?=?img_temp.ptr(y);
if?(pp[xx]?==?0)
{
if?(pp[xx?+?img_temp.step]?==?255)
{
if?(y? if?(y?>?y2)?temp_value?|=?(0x01?< if?(y?>?y1?&&?y?
}
}
}

//查表匹配
for?(int?model_i?=?0;?model_i? {
if?(temp_value?==?model_num2[model_i])
{
if?(model_i?==?8)?return?0;?//0為特殊情況
else?return?model_i?+?2;
}
}
printf(“not?match?id?is?[%d]\n“?temp_value);

return?-1;
}

int?main()
{
//Mat?img?=?imread(“img1.jpg“);
//Mat?img_show?=?img.clone();




//svm_train();
//waitKey(0);


while?(1)
{
Mat?img?=?imread(“IMG_2993.JPG“);
Mat?img_show?=?img.clone(); //用于顯示
Mat?img_gray;
Mat?img_roi;

namedWindow(“

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????6701??2019-05-26?13:55??main.cpp
?????文件??????231598??2019-05-26?10:44??IMG_2993.JPG

評論

共有 條評論