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

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

?? colourmodel.cpp

?? 基于均值漂移理論的該進算法
?? CPP
字號:
//colourModel.cpp - the colourModel object
//Iain Wallace 16/08/05

//Modified by xdb 2007-03-19
#include "stdafx.h"
#include "colourModel.h"
#include <math.h>
#include <iostream>
//using namespace cimg_library;
using namespace std;
colourModel::colourModel()
{
	//model must be initialised to 0
	memset( m_model, '\0', sizeof(m_model) );
	//Se we can tell if the memory's been allocated
	binsInit = false;
}
colourModel::~colourModel()
{
	//Free the bins memory, if it's assigned.
	if (binsInit)
	{
		if( bins != NULL )
		{
			for (unsigned int i=0; i< mX_dim; i++)
			{
				if( bins[i] != NULL )
					delete[] bins[i];
			}
			delete[] bins;
		}
		bins = NULL;
		binsInit = false;
		memset( m_model, '\0', sizeof(m_model) );
	}
}
double colourModel::operator[](unsigned int bin)
{
	//Use GTE as index is from 0
	if (bin >= NUMBINS)
	{
		cerr << "ERROR! Tried to access a model bin that doesn't exit!" << endl;
		return 0;
	}
	return m_model[bin];
}
unsigned int colourModel::findBin(unsigned char R,unsigned char G,unsigned char B)
{
	//return the bin number of a pixel according to its RGB value.
	//Note that the constants defined in the header file, and this function
	//control the only real tuning of the tracker.
	//scale the colours
	unsigned int r,g,b;
	r = (unsigned int)floor( (float)(R/BINSIZE) );
	g = (unsigned int)floor( (float)(G/BINSIZE) );
	b = (unsigned int)floor( (float)(B/BINSIZE) );
	//If, for example, the blue channel is not to be used, then change for:
	//b = 0;
	return (r + BPC*g + BPC*BPC*b);
}
void colourModel::clearModel()
{
	memset( m_model, '\0', sizeof(m_model) );
}

//This performs the function described by eqn(2) and eqn(4) (effectively the same)
//It saves the bin that each pixel is allocated too, as this prevents it being
//re-calculated when the weights are updated.
//void colourModel::updateModel(cimg_library::CImg<unsigned char>* image, //The image in question
//							  unsigned int centreX, //X co-ord of centre
//							  unsigned int centreY, //Y co-ord of centre
//							  int half_x, //half the x-size of the window
//							  int half_y, //half the y-size of the window
//							  double*** kArray) //the kernel
//{
//	clearModel();
//	//first time this is called, create bins with the size of the window
//	//NOTE: more cunning memory management would be required for reszizing windows!
//	if (!binsInit)
//	{
//		cout << "Allocating a bin allocation table" << endl;
//		//allocate the memory
//		mX_dim = 2*half_x+1;
//		mY_dim = 2*half_y+1;
//		bins = new unsigned int*[mX_dim];
//		for (unsigned int i=0;i<mX_dim;++i)
//			bins[i] = new unsigned int[mY_dim];
//		binsInit = true;
//	}
//	for (int x = -half_x;x <= half_x;++x)
//	{
//		for (int y = -half_y;y <= half_y;++y)
//		{
//			//update the bin allocation table at the same time
//			int iX = centreX + x;
//			int iY = centreY + y;
//			bins[x+half_x][y+half_y] = findBin((*image)(iX,iY,0),(*image)(iX,iY,1),(*image)(iX,iY,2));
//			//adding on the kernel function, instead of summing like a regular histogram,
//			//accounts for the delta function in the eqns.
//			m_model[bins[x+half_x][y+half_y]]+= (*kArray)[x+half_x][y+half_y];
//		}
//	}
//	//The model values must by normalised.
//	double total = 0;
//	for (int i = 0;i< NUMBINS;++i)
//	{
//		total += m_model[i];
//	}
//	for (int i = 0;i< NUMBINS;++i)
//	{
//		m_model[i] /= total;
//	}
//}

// Modified by xdb, 2007-03-19
// Because the first parameter in the origin function is CImag type. 
// So I override it using data area of image file to replace the first paramerter.

void colourModel::updateModel(BYTE* image, //The image in question
							  unsigned int centreX, //X co-ord of centre
							  unsigned int centreY, //Y co-ord of centre
							  int half_x, //half the x-size of the window
							  int half_y, //half the y-size of the window
							  double*** kArray, //the kernel
							  UINT bytesPerLine)	//Bytes per line
{	
	clearModel();
	//first time this is called, create bins with the size of the window
	//NOTE: more cunning memory management would be required for reszizing windows!
	if (!binsInit)
	{
		cout << "Allocating a bin allocation table" << endl;
		//allocate the memory
		mX_dim = 2*half_x+1;
		mY_dim = 2*half_y+1;
		bins = new unsigned int*[mX_dim];
		ZeroMemory(bins, mX_dim * sizeof(UINT));
		for (unsigned int i=0;i<mX_dim; i++)
		{
			bins[i] = new unsigned int[mY_dim];
			ZeroMemory(bins[i], mY_dim * sizeof(UINT));
		}
		binsInit = true;
	}
/*	for (int x = -half_x;x <= half_x;++x)
	{
		for (int y = -half_y;y <= half_y;++y)
		{
			//update the bin allocation table at the same time
			int iX = centreX + x;
			int iY = centreY + y;
			bins[x+half_x][y+half_y] = findBin((*image)(iX,iY,0),(*image)(iX,iY,1),(*image)(iX,iY,2));
			//adding on the kernel function, instead of summing like a regular histogram,
			//accounts for the delta function in the eqns.
			m_model[bins[x+half_x][y+half_y]]+= (*kArray)[x+half_x][y+half_y];
		}
	}*/

	//I modified the section because it not read data by consective address, I think the x represents width,
	// and y represents height. The followed is modfied code. 2007-03-19
	int m, n, x, y;
	m = n = x = y = 0;
	for( y = -half_y + int( centreY); y > 0, y < half_y + int(centreY); y++, m++ )
	{
		int p = y * bytesPerLine;
		for( x = -half_x + int(centreX),p += 3 * x, n = 0; x > 0 && x< half_x + int(centreX); x++, n++, p += 3 )
		{			
			BYTE b = *( image + p );
			BYTE g = *( image + p + 1 );
			BYTE r = *( image + p + 2);					
			UINT tmp = findBin(b, g, r);
			bins[n][m] = tmp;	
			//adding on the kernel function, instead of summing like a regular histogram,
			//accounts for the delta function in the eqns.
			m_model[tmp]+= (*kArray)[n][m];
		}

	}

	//The model values must by normalised.
	double total = 0;
	for (int i = 0;i< NUMBINS; i++)
	{
		total += m_model[i];	
	}
	for (int i = 0;i< NUMBINS; i++)
	{
		if( total == 0)
			m_model[i] = 0;
		else
			m_model[i] /= total;
	}
}
unsigned int colourModel::theBin(unsigned int x, unsigned int y)
{
	if ((x >= mX_dim) || (y >= mY_dim) || (!binsInit))
	{
		cerr << "ERROR! Attempted to access a pixel out of the window!" << endl;
		return( 0);
	}
	else
	{
		return(bins[x][y]);
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡的av在线| 狠狠v欧美v日韩v亚洲ⅴ| 久久精品夜色噜噜亚洲a∨| 欧美军同video69gay| 在线亚洲人成电影网站色www| 岛国一区二区在线观看| 国产精品一区二区在线看| 国产精品一区二区免费不卡| 久久99精品国产| 狠狠色狠狠色合久久伊人| 韩国毛片一区二区三区| 国产91丝袜在线观看| 成人18精品视频| 99v久久综合狠狠综合久久| 色婷婷综合久久久久中文一区二区 | 国产精品久久久久影视| 国产精品免费视频网站| 亚洲欧美日本韩国| 亚洲国产一区二区视频| 蜜乳av一区二区| 国产精品18久久久| 91福利区一区二区三区| 日韩一区二区免费视频| 国产欧美一区二区精品忘忧草| 国产精品网站在线观看| 亚洲一二三专区| 七七婷婷婷婷精品国产| 国产乱子轮精品视频| 色综合久久久久久久久久久| 在线成人免费观看| 中文字幕精品三区| 亚洲国产乱码最新视频| 久久99精品久久久久久| 97精品久久久久中文字幕| 3751色影院一区二区三区| 久久精品人人爽人人爽| 亚洲成人自拍偷拍| 国产成人a级片| 日韩一级精品视频在线观看| 日本一区二区三区在线不卡| 日韩电影免费一区| 99久久综合精品| 精品美女被调教视频大全网站| 亚洲视频资源在线| 国产一区二区美女| 欧美一区二区三区的| 亚洲综合在线观看视频| 国产一区二区毛片| 欧美裸体一区二区三区| 亚洲免费观看视频| 国产成人在线网站| 日韩欧美在线1卡| 亚洲国产综合视频在线观看| 成人精品视频一区二区三区| 日韩三级视频在线看| 亚洲一区二区三区小说| 丰满放荡岳乱妇91ww| 精品久久久久久综合日本欧美 | 欧美色大人视频| 国产精品入口麻豆九色| 国产精品一区免费在线观看| 欧美日韩国产乱码电影| 一区二区三区在线播放| 99免费精品在线观看| 日本一区二区成人在线| 国产一区二区三区四| 欧美成人女星排名| 美国十次了思思久久精品导航| 欧美精三区欧美精三区| 污片在线观看一区二区| 欧美三级欧美一级| 亚洲成a人v欧美综合天堂下载| 色偷偷一区二区三区| 亚洲黄色av一区| 欧美伊人久久久久久午夜久久久久| 中文字幕一区二区三区乱码在线| 国产999精品久久久久久| 中文字幕欧美区| eeuss鲁片一区二区三区在线观看| 国产亚洲成年网址在线观看| 国产麻豆精品视频| 欧美激情中文不卡| 99久久精品99国产精品| 亚洲色图20p| 欧美日韩在线播放| 日本中文一区二区三区| 欧美精品 日韩| 美女视频免费一区| 久久精品人人爽人人爽| 成人免费黄色在线| 亚洲激情一二三区| 91麻豆精品国产91久久久更新时间 | 91精品国产综合久久久蜜臀图片 | 福利91精品一区二区三区| 国产视频一区在线观看 | 青青草成人在线观看| 欧美一级国产精品| 国内精品视频一区二区三区八戒 | 中文字幕亚洲区| 欧美性大战久久| 麻豆国产精品官网| 国产精品你懂的在线| 一本在线高清不卡dvd| 肉丝袜脚交视频一区二区| 久久精品一区二区三区不卡牛牛 | 日本一区二区成人| 色综合天天做天天爱| 日本系列欧美系列| 日本一区二区久久| 91精品久久久久久蜜臀| 粉嫩嫩av羞羞动漫久久久 | 青椒成人免费视频| 欧美韩国一区二区| 91精品国产综合久久精品麻豆| 国产一区二区三区黄视频| 亚洲精选在线视频| 久久久亚洲高清| 7799精品视频| 91在线国产福利| 精一区二区三区| 亚洲第一成年网| 国产精品人妖ts系列视频 | 国产激情视频一区二区三区欧美| 亚洲欧美日韩国产一区二区三区| 欧美一区二区三区在线观看视频| av在线一区二区| 国内精品视频一区二区三区八戒| 艳妇臀荡乳欲伦亚洲一区| 国产亚洲欧美日韩日本| 欧美一级免费观看| 欧美日韩午夜在线视频| 成人国产视频在线观看| 久久激情五月激情| 美女在线视频一区| 亚洲电影你懂得| 亚洲一二三四在线| 亚洲色图欧美激情| 中文字幕一区二区三区蜜月 | 国产一区二区精品久久99| 偷拍亚洲欧洲综合| 亚洲综合在线免费观看| 亚洲视频在线观看三级| 国产日本欧美一区二区| 久久久久久久久99精品| 久久综合av免费| 欧美成人精品3d动漫h| 欧美一区二区视频在线观看2022| 欧美主播一区二区三区| 欧美体内she精视频| 色综合夜色一区| 91搞黄在线观看| 欧美色视频在线| 欧美精品免费视频| 欧美一区二区三区男人的天堂| 欧美区视频在线观看| 精品视频全国免费看| 欧美日韩一区久久| 欧美手机在线视频| 91精品国产一区二区三区蜜臀| 4438x亚洲最大成人网| 日韩欧美中文字幕制服| 2024国产精品| 久久一二三国产| 国产精品三级av| 亚洲亚洲精品在线观看| 视频一区在线播放| 久久精品99久久久| 成人一级片网址| 色婷婷精品大在线视频| 91精品欧美一区二区三区综合在| 欧美一区二区不卡视频| 久久综合成人精品亚洲另类欧美| 国产色婷婷亚洲99精品小说| 亚洲视频香蕉人妖| 婷婷一区二区三区| 国产精品自产自拍| 欧美在线观看视频一区二区| 91精品国产欧美一区二区18| 亚洲精品在线免费观看视频| 国产精品天美传媒沈樵| 亚洲大片一区二区三区| 国产精品一区二区在线看| 色视频成人在线观看免| 日韩一区二区免费在线观看| 国产欧美一区二区三区鸳鸯浴 | 日韩电影网1区2区| 成人美女视频在线观看18| 欧美无乱码久久久免费午夜一区| 日韩欧美高清在线| 1024精品合集| 久久国产日韩欧美精品| 99re免费视频精品全部| 日韩欧美国产午夜精品| 亚洲精品国产一区二区精华液| 免费黄网站欧美| 欧美无砖专区一中文字| 久久精品人人做人人爽人人| 日韩一区精品视频| 91久久国产最好的精华液| 国产欧美精品一区|