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

📄 img.h

📁 一个基于MFC的SIFT图像配准算法代码。好用
💻 H
字号:
// Img.h: interface for the CImg class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_IMG_H__ED4AB6AC_D9CD_4B1E_8C6E_05729372F3E8__INCLUDED_)
#define AFX_IMG_H__ED4AB6AC_D9CD_4B1E_8C6E_05729372F3E8__INCLUDED_

#if _MSC_VER > 1000

#include "inc/cv.h"
#include "inc/highgui.h"
#include "keypoint.h"
#include <stdio.h>

#pragma once
#endif // _MSC_VER > 1000

#define		LEVEL	20		//高斯金字塔的级数
#define		RATE	1.2		//每层高斯模糊半径的增长率
#define		N_KP	3000	//特征点的最大数量
#define		ELEM8(image,x,y)		(*((unsigned char*)(image)->imageData+(image)->widthStep*(y)/4+(x)))	//直接调用图像的像素,x、y为整数(图像数据应为8U)
#define		ELEM(image,x,y)		(*((float*)(image)->imageData+(image)->widthStep*(y)/4+(x)))	//直接调用图像的像素,x、y为整数(图像数据应为32F)
#define		ELEM_IN(image,x,y)	( (ceil(x+.0000001)-(x+.0000001))*(ceil(y+.0000001)-(y+.0000001))*ELEM((image),(int)floor(x+.0000001),(int)floor(y+.0000001)) + (ceil(x+.0000001)-(x+.0000001))*((y+.0000001)-floor(y+.0000001))*ELEM((image),(int)floor(x+.0000001),(int)ceil(y+.0000001)) + ((x+.0000001)-floor(x+.0000001))*(ceil(y+.0000001)-(y+.0000001))*ELEM((image),(int)ceil(x+.0000001),(int)floor(y+.0000001)) + ((x+.0000001)-floor(x+.0000001))*((y+.0000001)-floor(y+.0000001))*ELEM((image),(int)ceil(x+.0000001),(int)ceil(y+.0000001)) )//插值后的像素值(IN表示interpolation),x、y可以为小数
#define		PI 3.1415926




class CImg  
{
public:
	IplImage	*image_c;			//彩色图像
	IplImage	*image;				//单色图像
	IplImage	*image32f;			//32位浮点图像

	IplImage	*Gau[LEVEL];		//高斯模糊金字塔
	IplImage	*Dog[LEVEL-1];		//高斯差分金字塔

	int			width,height;

	CKeypoint	*kp;				//特征点数组的指针
	int			n_kp;				//特征点的个数

public:
	CImg();
	virtual ~CImg();
	void	CreateImg(char* filename);	//读取图像并构造Gau和Dog的金字塔
	void	FindKeypoint(void);			//找出图像中的特征点
	void	DrawKeypoint(void);			//在图像上画出特征点
	void	ShowImg(char *title);		//显示图像

	void	Direction4Kp(void);			//计算特征点的方向
	void	ConstructDescripter(void);	//提取特征点的特征

};

#endif // !defined(AFX_IMG_H__ED4AB6AC_D9CD_4B1E_8C6E_05729372F3E8__INCLUDED_)

⌨️ 快捷键说明

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