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

📄 project.cpp

📁 the code write C++. it is in image processing field. this code Read TIFF Image then it segment image
💻 CPP
字号:

#define BYTE unsigned  char

#include<iostream.h>
#include<io.h>
#include <ctype.h> 
#include<stdio.h>
#include<stdlib.h>
#include<io.h>
#include "Image.h"
#include "Segment.h"
#include <math.h>



void main()
{

	CImage  ImageVar;   // declaration of image
	Segment Seg;

	long m_lWidth=0;       
	long m_lHeight=0;            
	int i=0;
	//------ Load the dimension of the image -------//                    
	ImageVar.LoadDimensionOfImage(m_lWidth, m_lHeight);

	cout<<" main ok1 :m_lWidth ="<<m_lWidth<<endl;
	cout<<" main ok1 :m_lHeight="<<m_lHeight<<endl;
	int NBL = m_lHeight;
	int NBC = m_lWidth;


	float *InputImage=NULL;
	InputImage= new float[NBL*NBC];
	//------- Load the value of each pixel---------//
	ImageVar.ReadTIFFImage(m_lWidth, m_lHeight, InputImage);

	float *OutputImage=NULL;
	OutputImage= new float[NBL*NBC];
 

	
	cout <<"select 1 or 2\n";
	cout <<"1- segment image with M-thresholds.\n";
	cout <<"2- Otsu approch\n";
	cout <<"\n";
	int num = 0;
	cin >> num;

	switch(num){

		case 1: Seg.SegmentWithM(InputImage, OutputImage, NBL, NBC);
				break;
		
		case 2: Seg.OtsuThreshold(InputImage, OutputImage, NBL, NBC);
				break;
		
		default: 	cout <<" exsit \n";

		
	}


	InputImage=NULL;
	delete [] InputImage;

	ImageVar.WriteTIFFUnsignedChar(m_lWidth, m_lHeight, OutputImage);
	OutputImage=NULL;
	delete [] OutputImage;

}
 

⌨️ 快捷键说明

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