Welcome Guest, you are in: Login

MUST Creative Engineering Laboratory

RSS RSS

Navigation



Technical Doc



Search the wiki
»

MUST Corp.

MUST Corp.

www.must.or.kr

 Microsoft CERTIFIED Partner Software Development, Web Development, Data Platform

 Microsoft Small Business Specialist

MCSD

Microsoft Certified IT Professional

Microsoft Certified Professional Developer

Frequency Domain Filtering

RSS
Modified on 2010/08/06 15:20 by Administrator Categorized as Digital Image Processing

Ideal Lowpass Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		int d = (int)System.Math.Sqrt(x * x + y * y);

		// filter values outside the range
		if ((d > d0))
		{
			data[i, j].Re = 0;
			data[i, j].Im = 0;
		}
	}
}

Butterworth Lowpass Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		double d = System.Math.Sqrt(x * x + y * y);

		double h = 1.0 / (1.0 + System.Math.Pow(d / d0, 2.0 * n));
		data[i, j].Re *= h;
		data[i, j].Im *= h;
	}
}

Gaussian Lowpass Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		double d = System.Math.Sqrt(x * x + y * y);

		double h = System.Math.Exp(-d * d / 2.0 / d0 / d0);
		data[i, j].Re *= h;
		data[i, j].Im *= h;
	}
}

Ideal Highpass Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		int d = (int)System.Math.Sqrt(x * x + y * y);

		// filter values outside the range
		if ((d < d0))
		{
			data[i, j].Re = 0;
			data[i, j].Im = 0;
		}
	}
}

Butterworth Highpass Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		double d = System.Math.Sqrt(x * x + y * y);

		double h = 1.0 / (1.0 + System.Math.Pow(d0 / d, 2.0 * n));
		data[i, j].Re *= h;
		data[i, j].Im *= h;
	}
}

Gaussian Highpass Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		double d = System.Math.Sqrt(x * x + y * y);

		double h = 1.0 - System.Math.Exp(-d * d / 2.0 / d0 / d0);
		data[i, j].Re *= h;
		data[i, j].Im *= h;
	}
}

Homomorphic Filter

Image Image

Code

for (int i = 0; i < height; i++)
{
	int y = i - hh;

	for (int j = 0; j < width; j++)
	{
		int x = j - hw;
		double d = System.Math.Sqrt(x * x + y * y);

		double h = (γH - γL) * (1.0 - System.Math.Exp(-c * d * d / D0 / D0)) + γL;
		data[i, j].Re *= h;
		data[i, j].Im *= h;
	}
}

MUST Creative Engineering Laboratory

ImageImage Image Image

Image Image Image Image Image Image Image

Copyright © 2010 MUST Corp. All rights reserved. must@must.or.kr
This Program is released under the GNU General Public License v2. View the GNU General Public License v2 or visit the GNU website.