コード例 #1
0
void GetFDoG(imatrix& image, ETF& e, double sigma, double sigma3, double tau) 
{
	int	i, j;

    int image_x = image.getRow();
	int image_y = image.getCol();

	myvec GAU1, GAU2, GAU3;
	MakeGaussianVector(sigma, GAU1); 
	MakeGaussianVector(sigma*1.6, GAU2); 

	int half_w1, half_w2, half_l;
	half_w1 = GAU1.getMax()-1;
	half_w2 = GAU2.getMax()-1;
	
	MakeGaussianVector(sigma3, GAU3); 
	half_l = GAU3.getMax()-1;
	
	mymatrix tmp(image_x, image_y);
	mymatrix dog(image_x, image_y);

	GetDirectionalDoG(image, e, dog, GAU1, GAU2, tau);
	GetFlowDoG(e, dog, tmp, GAU3);

	for (i = 0; i < image_x; i++) { 
		for (j = 0; j < image_y; j++) {
			image[i][j] = round(tmp[i][j] * 255.);
		}
	}
}
コード例 #2
0
ファイル: fdog.cpp プロジェクト: barqui/CGLapSeoulCityProject
void GaussSmoothSep(imatrix& image, double sigma)
{
	int	i, j;
	double g, max_g, min_g;
	int s, t;
	int x, y;
	double weight, w_sum;

	int image_x = image.getRow();
	int image_y = image.getCol();

	myvec GAU1;
	MakeGaussianVector(sigma, GAU1); 
	int half = GAU1.getMax()-1;

	mymatrix tmp(image_x, image_y);
		
	max_g = -1;
	min_g = 10000000;
	for (j = 0; j < image_y; j++) {
		for (i = 0; i < image_x; i++) {
			g = 0.0;
			weight = w_sum = 0.0;
			for (s = -half; s <= half; s++) {
				x = i+s; y = j;
				if (x > image_x-1) x = image_x-1;
				else if (x < 0) x = 0;
				if (y > image_y-1) y = image_y-1;
				else if (y < 0) y = 0;
				weight = GAU1[ABS(s)];
				g += weight * image[x][y];
				w_sum += weight;
			}
			g /= w_sum;
			if (g > max_g) max_g = g;
			if (g < min_g) min_g = g;
			tmp[i][j] = g;
		}
	}
	for (j = 0; j < image_y; j++) {
		for (i = 0; i < image_x; i++) {
			g = 0.0;
			weight = w_sum = 0.0;
			for (t = -half; t <= half; t++) {
					x = i; y = j+t;
					if (x > image_x-1) x = image_x-1;
					else if (x < 0) x = 0;
					if (y > image_y-1) y = image_y-1;
					else if (y < 0) y = 0;
					weight = GAU1[ABS(t)];
					g += weight * tmp[x][y];
					w_sum += weight;
			}
			g /= w_sum;
			if (g > max_g) max_g = g;
			if (g < min_g) min_g = g;
			image[i][j] = round(g);
		}
	}
}