⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 threshold.c

📁 适用于TI公司DM642的阈值分割例程 很好的资料
💻 C
字号:
/*****************************************************************
** 函数名:	GradationThreshold
**		GradationThresholdRGB
**		GradationThresholdYUV
** 输 入: 	InImagebuf , Height, Width, Threshold
** InImagebuf---输入图像处理前显示区指针。
** Height---	显示区的行长度。
** Width---	显示区的列长度。
** Threshold---	灰度阈值。
** 输 出: 	OutImagebuf
** OutImagebuf---输出图像处理后显示区指针。
** 功能描述:	灰度阈值变换。
** 全局变量:	无。
** 调用模块:	无。
** 作 者:	wdm
** 日 期:	2003-11-7
** 修 改:
** 日 期:
** 版 本		v1.0
****************************************************************/
void GradationThreshold( InImagebuf, Height, Width, OutImagebuf, Threshold)
unsigned char	* InImagebuf;
volatile unsigned int	Height;
unsigned int	Width;
unsigned char 	* OutImagebuf;
unsigned char	Threshold;
{
	unsigned int j;
	for( j = 0; j < Height * Width; j++)
	{
		if(*InImagebuf++ >= Threshold)
		{
			*OutImagebuf++ = 255;
		}
		else	
		{
			*OutImagebuf++ = 0;
		}
	}	
	return;
}
void GradationThresholdRGB( InImagebuf, Height, Width, OutImagebuf, Threshold)
unsigned char	* InImagebuf;
volatile unsigned int	Height;
unsigned int	Width;
unsigned char 	* OutImagebuf;
unsigned char	Threshold;
{
	unsigned int j;
	for( j = 0; j < Height * Width * 3; j++)
	{
		if(*InImagebuf++ >= Threshold)
		{
			*OutImagebuf++ = 255;
		}
		else	
		{
			*OutImagebuf++ = 0;
		}
	}	
	return;
}
void GradationThresholdYUV( InImagebuf, Height, Width, OutImagebuf, Threshold)
unsigned char	* InImagebuf;
volatile unsigned int	Height;
unsigned int	Width;
unsigned char 	* OutImagebuf;
unsigned char	Threshold;
{
	unsigned int j;
	for( j = 0; j < Height * Width * 2; j++)
	{
		if(*InImagebuf++ >= Threshold)
		{
			*OutImagebuf++ = 255;
		}
		else	
		{
			*OutImagebuf++ = 0;
		}
	}	
	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -