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

📄 threshold_mid.cpp

📁 各种算术算法
💻 CPP
字号:


//--------------------------------
//    hustxdp   2007/10/30 16:10
//--------------------------------


//#include "stdAfx.h"

/*--threshold_mid----雙閾值二值化處理-----------------
   image_in   :  輸入圖象數據指針
   image_out  :  輸出圖象數據指針
   xsize      :  圖象寬度
   ysize      :  圖象高度
   thresh_low :  低閾值(0~255)
   thresh_high:  高閾值(0~255)

  ----------------------------------------------------*/
const int HIGH=255;
const int LOW=0;

void threshold_mid(BYTE *image_in, BYTE *image_out, int xsize, int ysize, int threshold_low, int threshold_high)
{
	int i,j;
	for (j = 0; j < ysize; j++)
	{
		for (i = 0; i < xsize; i++)
		{
			if(*(image_in +j*xsize +i)>=threshold_low && *(image_in +j*xsize + i)<=threshold_high)
				*(image_out + j*xsize + i) = HIGH;
			else
				*(image_out + j*xsize + i) = LOW;

		}
	}
}

⌨️ 快捷键说明

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