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

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

?? matching_shifting.cpp

?? trustlink企業版開發平臺
?? 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一区二区三区免费野_久草精品视频
色综合咪咪久久| 欧美婷婷六月丁香综合色| 激情伊人五月天久久综合| 国产乱码精品1区2区3区| 成人高清在线视频| 在线电影欧美成精品| 精品99久久久久久| 国产精品久久久久aaaa| 亚洲一区二区在线播放相泽| 免费高清在线视频一区·| 国产大陆亚洲精品国产| 欧洲激情一区二区| 国产精品网曝门| 蜜芽一区二区三区| 成人99免费视频| 日韩欧美国产精品| 香蕉av福利精品导航| 国产成人午夜精品影院观看视频| 色欧美片视频在线观看| 久久精品一区二区三区不卡 | 在线看日韩精品电影| 国产欧美1区2区3区| 久久激情综合网| 欧美日韩免费在线视频| 亚洲视频中文字幕| caoporen国产精品视频| 欧美极品少妇xxxxⅹ高跟鞋 | 色视频成人在线观看免| 国产欧美日韩中文久久| 美女一区二区在线观看| 欧美精品123区| 亚洲高清视频中文字幕| 一本到高清视频免费精品| 亚洲国产精华液网站w| 国产精品原创巨作av| 久久久美女毛片| 成人短视频下载| 成人欧美一区二区三区视频网页| 不卡欧美aaaaa| 中文字幕亚洲电影| 在线电影院国产精品| 蜜臀精品久久久久久蜜臀 | 日本不卡一二三| 欧美夫妻性生活| 久久66热re国产| 国产精品色呦呦| 欧美视频日韩视频| 国内精品在线播放| 中文字幕巨乱亚洲| 欧美日韩在线三区| 国产一区二区三区免费在线观看| 亚洲久草在线视频| 欧美色综合网站| 久久超碰97中文字幕| 国产日韩欧美麻豆| 99这里只有精品| 久久精品国产精品亚洲综合| 自拍偷拍亚洲欧美日韩| 在线不卡一区二区| 99久久久免费精品国产一区二区| 五月天一区二区三区| 亚洲欧洲精品天堂一级| 久久久国际精品| 91麻豆精品国产无毒不卡在线观看| 国产成人免费xxxxxxxx| 蜜臀久久99精品久久久久宅男| 玉足女爽爽91| 亚洲人妖av一区二区| 中文字幕av一区二区三区| 久久女同互慰一区二区三区| 欧美精品九九99久久| 91行情网站电视在线观看高清版| 91在线云播放| 色天使久久综合网天天| 色丁香久综合在线久综合在线观看| 99久久综合精品| 91视频91自| 欧美美女一区二区在线观看| 欧美日韩高清在线| 7777精品久久久大香线蕉| 在线不卡中文字幕| 日韩亚洲欧美综合| 亚洲精品在线网站| 欧美国产成人在线| 亚洲乱码国产乱码精品精小说| 亚洲欧美另类小说| 亚洲观看高清完整版在线观看| 亚洲成人资源网| 日韩 欧美一区二区三区| 激情综合网激情| 成人激情小说网站| 欧美综合视频在线观看| 欧美日本精品一区二区三区| 国产欧美日韩在线看| 国产精品久久免费看| 亚洲综合视频网| 国产自产v一区二区三区c| 成人一区二区三区中文字幕| 在线精品视频小说1| 久久久国际精品| 午夜精品久久久| 成人理论电影网| 日韩三级在线免费观看| 国产精品短视频| 精品伊人久久久久7777人| 日本韩国欧美三级| 国产精品妹子av| 国产一区不卡视频| 欧美午夜寂寞影院| 国产欧美日本一区二区三区| 日韩av高清在线观看| 日本韩国欧美三级| 日韩一区有码在线| 国产福利一区二区| 91精品国产乱码| 亚洲一区在线观看免费| 成人性生交大片免费看在线播放 | 久久91精品久久久久久秒播| 在线欧美小视频| 亚洲综合无码一区二区| 91在线视频播放地址| 国产精品久久久久久久午夜片| 美腿丝袜亚洲色图| 精品少妇一区二区三区| 美女任你摸久久| 精品国产露脸精彩对白 | 91精品国产综合久久小美女| 人禽交欧美网站| 日韩网站在线看片你懂的| 日韩福利视频网| 精品国产免费人成在线观看| 国产一区二区在线观看免费 | 久久99久久精品欧美| 国产婷婷色一区二区三区在线| 成人动漫一区二区三区| 亚洲人成伊人成综合网小说| 日本道色综合久久| 国产传媒久久文化传媒| 国产亚洲欧美日韩日本| 色婷婷综合五月| 亚洲成人资源网| 国产欧美一区二区三区在线看蜜臀 | 99久久久久久99| 免费看精品久久片| 国产精品丝袜黑色高跟| 日韩一级片在线播放| aaa亚洲精品| 蜜桃在线一区二区三区| 中文字幕视频一区| 精品国产乱码久久久久久久久| av在线不卡网| 国产一区不卡在线| 蜜桃av一区二区在线观看| 国产精品免费视频网站| 欧美一区二区三区人| 91色综合久久久久婷婷| 福利一区福利二区| 美女视频免费一区| 五月天激情综合网| 亚洲视频在线观看三级| 欧美激情一二三区| 精品国产自在久精品国产| 日本高清不卡视频| 91麻豆国产精品久久| 国产白丝网站精品污在线入口| 三级欧美韩日大片在线看| 一区二区三区四区亚洲| 亚洲男人电影天堂| 亚洲一卡二卡三卡四卡五卡| 亚洲a一区二区| 一区二区三区在线不卡| 亚洲三级在线观看| 洋洋成人永久网站入口| 亚洲国产一区二区a毛片| 亚洲综合一区二区精品导航| 亚洲自拍都市欧美小说| 日韩精品国产欧美| 精品午夜久久福利影院| 国模大尺度一区二区三区| 国产成人精品三级| jlzzjlzz亚洲女人18| 欧美午夜免费电影| 制服丝袜中文字幕亚洲| www成人在线观看| 亚洲视频中文字幕| 丝袜亚洲另类丝袜在线| 国产在线一区二区综合免费视频| 国产精品自拍在线| 91蜜桃在线观看| 91精品国产高清一区二区三区| 欧美国产成人精品| 日本不卡一二三区黄网| 91在线观看下载| 精品久久久久av影院| 亚洲欧美日韩综合aⅴ视频| 美腿丝袜亚洲一区| 欧美日精品一区视频| 久久久精品国产99久久精品芒果 | 91久久国产综合久久| 国产亚洲污的网站|