亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? matching_shifting.cpp

?? 指紋識別程序
?? CPP
字號:
/*########################################################################  The contents of this file are subject to the Mozilla Public License  Version 1.0(the "License");   You  may  NOT  use this file except in  compliance with the License. You may obtain a copy of the License at                http:// www.mozilla.org/MPL/  Software distributed under the License is distributed on an "AS IS"  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See  the License for the specific language governing rights and limitations  under the License.  The Initial Developer of the Original Code is Shivang Patel.  Copyright(C) 2002. All Rights Reserved.  Authors: Shivang Patel           Jaap de Haan(jdh)  ########################################################################*/#ifndef __MATCHING_SHIFTING_CPP__#define __MATCHING_SHIFTING_CPP__#include "fvsimage.h"#include "fvstypes.h"#include "vector.h"#include "matching_shifting.h"typedef struct Shift_t{	uint32_t count;	int32_t shiftval;} Shift_t;template <class itemType>int AddShift(int32_t shiftval, Vector<Shift_t> & shiftstr, uint32_t & lastindex, itemType junk);template <class itemType>uint32_t CountMatching(FvsImage<itemType> & TemplateImg, FvsImage<itemType> & VerifyingImg, int32_t shiftx, int32_t shifty);template <class itemType>void ShiftImage(FvsImage<itemType> & img, int32_t shiftx, int32_t shifty);// Matching using Shifting// This matching algorithm shifts the verifying image left\right and// up\down to find where the most line pixels line up (no pun intended).// This algorithm works only when both images are the same scale and there// is no rotation in either image.// Think of the two images on a transpaceny, moving one on top of the other// most, if not all, of the lines will match up. If they are not the same// fingerprint they do not line up.// // This function will return the percentage of the number of line pixels// that line up over the total number of line pixels there are in the // template image. The calling function should then check this percentage// if it is high enough then it is a correct match. If it is the same image // there should be no shift and 100% should be returned. //// --SPtemplate <class itemType>float_t Match_Shifting(FvsImage<itemType> & TemplateImg, FvsImage<itemType> & VerifyingImg){	uint32_t linecount = 0;			// holds total number of line pixels in template image	uint32_t linecount2 = 0;	int32_t x, y;					// loop variables	int32_t lastx, lasty;				Vector<Shift_t> shiftx, shifty; // vector/array of shift structs, holds the shift values	uint32_t lastxshiftindex = 0;	// holds last index for vector above	uint32_t lastyshiftindex = 0;	// same as above except for y axis vector	int32_t finalxshift = 0;		// the final value we shift on the x-axis	int32_t finalyshift = 0;		// same as above except for y-axis	uint32_t lastcount = 0;	uint32_t finalmatchcount = 0;	// how many line pixels line up after all shift is complet	uint32_t temp;	// first thing is make sure that both images are the same size otherwise return with 0	if ((TemplateImg.width() != VerifyingImg.width()) ||		(TemplateImg.height() != VerifyingImg.height()))	{ 		// Error message\output here		return 0;	}	// find the total number of line pixels in template image, store in linecount variable	for (x = 0; x < (int32_t)TemplateImg.width(); x++)	{		for (y = 0; y < (int32_t)TemplateImg.height(); y++)		{			if (TemplateImg[x][y])				linecount++;		} // for y	} // for x	for (x = 0; x < (int32_t)VerifyingImg.width(); x++)	{		for (y = 0; y < (int32_t)VerifyingImg.height(); y++)		{			if (VerifyingImg[x][y])				linecount2++;		}	}	if (lincount < linecount2) linecount = linecount2;	// allocate enought memory for vectors	shiftx.resize(2 * linecount);	shifty.resize(2 * linecount);	// If they are the exact same image, or they match really well without any shifting	// don't bother with the extra work	if (CountMatching(TemplateImg, VerifyingImg, 0, 0) == linecount)		return 100.0;	// now loop through image and find the shifts, first on the x-axis	for (y = 0; y < (int32_t)TemplateImg.height(); y++)	{		for (x = 0; x < (int32_t)TemplateImg.width(); x++)		{			// see if the current pixel is a line pixel, otherwise continue on			if (TemplateImg[x][y])			{				lastx = x;				// move to the left and find first line pixel in verifying image				while ((lastx >= 0) && (VerifyingImg[lastx][y] != COLOR_LINE))					// we have not yet found a line pixel continue to look					lastx--;				// either we have found a line pixel or we have reached the end				if (lastx >= 0)					// we have found a line pixel add the difference between					// the Temlate Image pixel and the Verifying Image pixel, 					// this is the shift value					AddShift(-(x - lastx), shiftx, lastxshiftindex, 0);				// Now find the first line pixel going to the right				lastx = x + 1;				while ((lastx < (int32_t)VerifyingImg.width()) && (VerifyingImg[lastx][y] != COLOR_LINE))					// we have not yet found a line pixel continue to look					lastx++;				// either we have found a line pixel or we have reached the end 				if (lastx < (int32_t)VerifyingImg.width())					// we have found a line pixel add the difference between 					// the template image pixel and the verifying image pixel					// this is the shift value					AddShift((lastx - x), shiftx, lastxshiftindex, 0);			} // if current pixel is line pixel		} // for x	} //for y	// now find the shift on the y-axis	for (x = 0; x < (int32_t)TemplateImg.width(); x++)	{		for (y = 0; y < (int32_t)TemplateImg.height(); y++)		{			// make sure the current pixel is a line piel			if (TemplateImg[x][y])			{				lasty = y;								// find the shift foing up				while ((lasty >= 0) && (VerifyingImg[x][lasty] != COLOR_LINE))					// we have not yet found a line pixel continue to look					lasty--;				// either we have found a line pixel or we have reached the end				if (lasty >= 0)					// we have found a line pixel add the difference between 					// the template image pixel and the verifying image pixel					// this is the shift value					AddShift(-(y - lasty), shifty, lastyshiftindex, 0);				// now find the shift going down				lasty = y + 1;				while ((lasty < (int32_t)VerifyingImg.height()) && (VerifyingImg[x][lasty] != COLOR_LINE))					// we have not yet found a line pixel continue to look					lasty++;				// either we have found a line pixel or we have reached the end				if (lasty < (int32_t)VerifyingImg.height())					// we have found a line pixel add the difference between					// the template image pixel and the verifying image pixel					// this is the shift value					AddShift((lasty - y), shifty, lastyshiftindex, 0);			} // current pixel a line pixel ?		} // for y	} // for x	// find best shift values	for (x = 0; x < (int32_t)lastxshiftindex; x++)	{		if ((shiftx[x].shiftval != 0) && (shiftx[x].count > 20) &&			((temp = CountMatching(TemplateImg, VerifyingImg, shiftx[x].shiftval, 0)) > lastcount))		{			finalxshift = shiftx[x].shiftval;			lastcount = temp;		}	}		// now find best shift on y-axis	//lastcount = 0;	for (y = 0; y < (int32_t)lastyshiftindex; y++)	{		if ((shifty[y].shiftval != 0) && (shifty[y].count > 20) && 			((temp = CountMatching(TemplateImg, VerifyingImg, finalxshift, shifty[y].shiftval)) > lastcount))		{			finalyshift = shifty[y].shiftval;			lastcount = temp;		}	}			// now shift image according to the shift values we found above	ShiftImage(VerifyingImg, finalxshift, finalyshift);	// calculate how many line pixels match up	finalmatchcount = CountMatching(TemplateImg, VerifyingImg, 0, 0);			// print exact values, this is more for testing purposes	printf("Shift Matching: Exact values: number matching: %d out of: %d\n", finalmatchcount, linecount);	// return the % of line pixels that match up over the total number of line pixels in the template image	return finalmatchcount * 100.0/linecount;}// this adds a shift value to the vector, but first makes sure that the value does// not already exist. If the value does exist it increments the count value // of the shift value instead of adding the shift value//// Side note: the junk variable is there because I have to make the function a template function// the reason is because Match_Shifting needs to be template class because it uses FvsImage class,// and since I want to keep similar functions together in the same file, this function must be a// template function. The same problems occurs for the BitmapWriteHeader() function in fmt_bitmap.cpp// If anyone knows how to fix this please let me know // --SPtemplate <class itemType>int AddShift(int32_t shiftval, Vector<Shift_t> & shiftstr, uint32_t & lastindex, itemType junk){	for (uint32_t i = 0; i < lastindex; i++)	{		// see if the value already exists		if (shiftstr[i].shiftval == shiftval)		{			shiftstr[i].count++;			return 0; // 0 means nothing was added to the vector		}	} // for i	// we have not yet exited so the value must not already exist in the vector	// so add it. First make sure we don't go beyond the size of vector 	if (lastindex >= shiftstr.size())		// Add 10 slots to the vector so we don't take up too much memory		shiftstr.resize(shiftstr.size() + 10);	shiftstr[lastindex].shiftval = shiftval;	shiftstr[lastindex].count = 0;	lastindex++;	return 1; // one item added to the vector	}// This function loops through the two images and finds how many line pixels match up // with the new shift valuestemplate <class itemType>uint32_t CountMatching(FvsImage<itemType> & TemplateImg, FvsImage<itemType> & VerifyingImg, int32_t shiftx, int32_t shifty){	int32_t MatchesFound = 0;	uint32_t x, y, startx, starty, endx, endy;	startx = ((shiftx < 0)?0:shiftx);	starty = ((shifty < 0)?0:shifty);	endx = TemplateImg.width() + ((shiftx < 0)?shiftx:0);	endy = TemplateImg.height() + ((shifty < 0)?shifty:0);	for (x = startx; x < endx; x++)	{		for (y = starty; y < endy; y++)		{			// don't do anything unless it is a line pixel			if (((x + shiftx) >= 0) && ((x + shiftx) < VerifyingImg.width()) &&				((y + shifty) >= 0) && ((y + shifty) < VerifyingImg.height()) &&				(TemplateImg[x][y]) && (VerifyingImg[x + shiftx][y + shifty]))				MatchesFound++;		} // for y	} // for x	return MatchesFound;}// Works better with a seperate function then in the code especially since // we are going to make a copy of the image, once the function exits the// variables destory itself, freeing up memory. template <class itemType>void ShiftImage(FvsImage<itemType> & img, int32_t shiftx, int32_t shifty){	uint32_t x, y;	FvsImage<itemType> imgcopy = img;	for (x = 0; x < imgcopy.width(); x++)	{		for (y = 0; y < imgcopy.height(); y++)		{			// don't do anything unless it is a line pixel			if (((x + shiftx) >= 0) && ((x + shiftx) < imgcopy.width()) &&				((y + shifty) >= 0) && ((y + shifty) < imgcopy.height()))				img[x][y] = imgcopy[x + shiftx][y + shifty];			else				img[x][y] = COLOR_BACKGROUND;		} // for y	} // for x}#endif // __MATCHING_SHIFTING_CPP__

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产欧美一区二区| 国产在线乱码一区二区三区| 亚洲一区自拍偷拍| 91精品国产综合久久精品图片| 久久久99久久| 精品国精品自拍自在线| 国产成人免费在线观看| 免费观看30秒视频久久| 成人av电影在线观看| 欧美一级二级在线观看| 一区二区三区在线看| 国产综合成人久久大片91| 欧美麻豆精品久久久久久| 日韩理论片网站| 亚洲香蕉伊在人在线观| 免费视频最近日韩| 夜夜嗨av一区二区三区网页| 91久久国产最好的精华液| 国产精品第四页| 成人午夜大片免费观看| 日韩一区二区三区免费观看| 激情图片小说一区| 中文字幕中文乱码欧美一区二区| 日韩经典中文字幕一区| 《视频一区视频二区| 久久99国内精品| 午夜精品福利视频网站| 亚洲欧美成aⅴ人在线观看| 亚洲一区二区视频| 一本到不卡精品视频在线观看| 国产精品91xxx| 欧美视频一二三区| 美女视频黄 久久| 亚洲一级电影视频| 亚洲成人午夜影院| 亚洲成a人v欧美综合天堂下载| 亚洲国产中文字幕在线视频综合| 美女一区二区在线观看| 久久99国产精品麻豆| 国产一区在线看| 亚洲电影在线播放| 日本不卡视频一二三区| 91精品国产综合久久久久久| 精品一区二区三区在线播放视频| 精品综合久久久久久8888| 韩国成人在线视频| 91在线视频播放地址| 在线观看国产91| 精品99一区二区| 成人激情校园春色| 国产一区二区调教| 色综合久久综合中文综合网| 91精品国产色综合久久久蜜香臀| 欧美精品一区二区三区蜜桃视频 | 国产精品一卡二卡在线观看| 日韩一区二区三区在线观看| 欧美裸体一区二区三区| 成人av资源在线| 成人免费av网站| 色婷婷综合五月| 精品国产区一区| 亚洲夂夂婷婷色拍ww47| 91黄视频在线| 国产精品欧美一区二区三区| www日韩大片| 欧美国产综合色视频| 亚洲国产一区视频| 玖玖九九国产精品| 欧美在线观看你懂的| 日韩精品一区二区三区蜜臀 | 麻豆91精品视频| 在线视频综合导航| 亚洲国产电影在线观看| 午夜精品123| 91在线你懂得| 一个色综合av| 91色婷婷久久久久合中文| 国产亚洲1区2区3区| 日韩中文字幕区一区有砖一区 | 黑人巨大精品欧美黑白配亚洲| 欧美视频在线播放| 日日夜夜精品视频天天综合网| 欧美日韩精品电影| 亚洲欧美国产毛片在线| 99国产精品99久久久久久| 亚洲高清免费视频| 欧美丰满嫩嫩电影| 国产一区二区看久久| 国产精品高潮呻吟久久| a亚洲天堂av| 亚洲午夜激情av| 精品久久久久av影院 | 亚洲高清在线视频| 久久日韩粉嫩一区二区三区| eeuss鲁片一区二区三区在线观看| 亚洲三级免费观看| 欧美三级一区二区| 丰满少妇久久久久久久| 视频在线观看一区二区三区| 国产拍揄自揄精品视频麻豆| 一本色道**综合亚洲精品蜜桃冫| 免费在线观看成人| 亚洲一区二区高清| 亚洲国产精品v| 久久综合九色综合欧美亚洲| 91网站视频在线观看| 美女脱光内衣内裤视频久久网站| 久久先锋资源网| 日韩女优电影在线观看| 欧美性猛交一区二区三区精品| 麻豆成人免费电影| 亚洲第一狼人社区| 一区二区欧美精品| 国产精品免费视频观看| 欧美日韩黄色一区二区| 国产成人在线视频网站| 狠狠色狠狠色合久久伊人| 麻豆高清免费国产一区| 香蕉成人伊视频在线观看| 91精品国产免费| 欧美日韩国产大片| www.亚洲色图| 91婷婷韩国欧美一区二区| 成人黄色电影在线| 色欧美日韩亚洲| 欧美日韩一区二区三区在线| 欧美日韩国产在线观看| 884aa四虎影成人精品一区| 精品国产网站在线观看| 亚洲国产精品激情在线观看| 一区二区三区中文字幕在线观看| 亚洲午夜精品久久久久久久久| 老司机精品视频在线| 高清beeg欧美| 欧美巨大另类极品videosbest | 午夜精品在线看| 久久99国产精品麻豆| 国产精品456| 51午夜精品国产| 国产精品第13页| 日本美女一区二区三区| 国产不卡免费视频| 91国产免费观看| 久久色中文字幕| 免费观看成人鲁鲁鲁鲁鲁视频| 成人a免费在线看| 久久久久国色av免费看影院| 五月天久久比比资源色| 成人国产精品免费观看动漫| 久久久另类综合| 国产在线播放一区三区四| 欧美日韩国产一二三| 亚洲精品视频自拍| 成人午夜在线视频| 久久久久久久久免费| 国产一区二区主播在线| 91精品国产一区二区三区蜜臀| 亚洲欧美国产77777| 色综合久久中文综合久久牛| 亚洲色图欧洲色图| 成人av午夜电影| 亚洲激情在线播放| 欧美日韩视频在线一区二区| 香港成人在线视频| 91精品啪在线观看国产60岁| 日本午夜一区二区| 国产日韩欧美综合在线| 精油按摩中文字幕久久| 国产精品妹子av| 欧美成人猛片aaaaaaa| 国产中文字幕精品| 亚洲精品乱码久久久久久久久| 欧美午夜宅男影院| 国产在线播放一区三区四| 国产精品久久久久精k8| 欧美大片在线观看| 91美女片黄在线| 日韩av不卡一区二区| 欧美高清在线精品一区| 欧美视频一区二区三区在线观看 | 一区二区三区四区视频精品免费 | 欧美一区二区三区在| 国产成人精品一区二区三区四区| 亚洲人快播电影网| 久久网这里都是精品| 欧美一区二区三区系列电影| av亚洲精华国产精华精| 日本欧美加勒比视频| 一区二区成人在线| 国产日韩欧美一区二区三区综合 | 久久精品国产成人一区二区三区| 国产精品国产三级国产专播品爱网| 欧美一级日韩免费不卡| 91黄色免费看| av在线不卡观看免费观看| 国产成人在线网站| 国产成人精品三级| 成人三级在线视频| 成人av在线播放网址| zzijzzij亚洲日本少妇熟睡|