it is in image processing field. this code Read TIFF Image then it excute compute histogram and hist

源代码在线查看: mask.cpp

软件大小: 400 K
上传用户: changke8311
关键词: processing histogram compute excute
下载地址: 免注册下载 普通下载 VIP

相关代码

				// mask.cpp: implementation of the mask class.
				//
				//////////////////////////////////////////////////////////////////////
				
				#include "mask.h"
				#include
				
				//////////////////////////////////////////////////////////////////////
				// Construction/Destruction
				//////////////////////////////////////////////////////////////////////
				
				mask::mask()
				{
				
				}
				
				mask::~mask()
				{
				
				}
				
				//////////////////////////////////////////////////////////////////////////
				//the Laplacian Mask
				//////////////////////////////////////////////////////////////////////////
				
				void mask::Laplacian_Mask(float *InputImage, float *OutputImage, int NBL, int NBC)
				{
				
					float Derivation_Sec,min=0,max=255;
					int pos=0, i, j, k, l,size = 3;
					int M[9] = {1,1,1,1,-8,1,1,1,1}; 
				
				// apply the Laplacian Mask
				
					for(i=size/2; i						for(j=size/2; j						{
							Derivation_Sec = 0;
							pos = 0; 
							
							for(k=i-(size/2); k								for(l=j-(size/2); l								{
									Derivation_Sec += InputImage[l+k*NBC] * M[pos];
									pos++;
								}
				
							OutputImage[j+i*NBC] = InputImage[j+i*NBC] - Derivation_Sec;
				
						}
				
				//linear transformation
				
					for (i=1; i						{
							if (min > OutputImage[i]) 
								min = OutputImage[i];
				
							if (max < OutputImage[i]) 
								max = OutputImage[i];
						}	
				
				
					for (i=0; i						OutputImage[i] = (OutputImage[i] - min) * 255/max;
					
				
				}
				
				/////////////////////////////////////////////////////////////////////////
				//the Sobel Mask
				//////////////////////////////////////////////////////////////////////////
				
				void mask::Sobel_Mask(float *InputImage, float *OutputImage, int NBL, int NBC)
				{
				
					int pos=0, i, j, k, l,size = 3;
					int Mx[9] = {-1,-2,-1,0,0,0,1,2,1}; 
					int My[9] = {-1,0,1,-2,0,2,-1,0,1}; 
					float Gx=0.0, Gy=0.0;
				
				
				// apply the Sobel Mask
				
					for(i=size/2; i						for(j=size/2; j						{
							pos = 0;
							Gx= 0.0;
							Gy =0.0;
					 
							for(k=i-(size/2); k								for(l=j-(size/2); l								{
									Gx += InputImage[l+k*NBC] * Mx[pos];
									Gy += InputImage[l+k*NBC] * My[pos];
									pos++;
								}
							
				
							OutputImage[j+i*NBC] = abs(Gx) + abs(Gy);
				
						}
				
				
				}
							

相关资源