求一份gist特征提取的opencv完整代碼
大致程序:
1. 創建Gabor濾波器組
2. 對原彩色圖求均值轉為灰度影像
3. 對影像進行預濾波 縮放區域對比度
4. 分塊計算gabor特征并組合
uj5u.com熱心網友回復:
#pragma once
#include
using namespace cv;
#define WIDTH 256 //影像寬度 256
#define HEIGHT 256 //影像高度 256
//#define M_PI 3.1416 //π
class Gist
{
public:
typedef struct matList
{
int size;
Mat* data;
} MatList;
typedef struct gistParam
{
CvSize imageSize;
int orientations; //8
int scale; //4
int* orientationsPerScale; //[8 8 8 8]
int numberBlocks; //4
int fc_prefilt; //4
int boundaryExtension; //32
MatList gabor;
} GistParam;
Gist(void);
Gist(CvSize imagesize, int* orientationsPerScale, int scale, int numberBlocks = 4, int fc_prefilt = 4, int boundaryExtension = 32);
~Gist(void);
Mat padarray(Mat mat, CvSize padsize = cvSize(5, 5), CString padval = _T("symmetric"), CString direction = _T("both"));
MatList createGabor(int *or, CvSize size);
Mat prefilt(Mat img, int fc = 4);
Mat gistGabor(Mat img);
Mat downN(Mat img, int N);
Mat calImageGist(CString filename);
Mat calImageGist(IplImage* image);
Mat calImageListGist(vector fileList);
static void fftshift(Mat data); //fft移位
static void fftshift(float *data, int w, int h); //fft移位
static Mat getReal(Mat complex_data); //獲取復數矩陣實部
static Mat getAbs(Mat complex_data); //獲取復數矩陣絕對值
static void saveFeatureToFile(CString filename, Mat mat); //存盤mat
private:
GistParam param;
};
uj5u.com熱心網友回復:
http://download.csdn.net/detail/ying_xu/9413394uj5u.com熱心網友回復:
有我實作了Gist的LMGIST版本(就是matlab那個)
下面是對應的Github和博文
代碼: https://github.com/Kalafinaian/python-img_gist_feature
博文: https://zhuanlan.zhihu.com/p/88
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/31951.html
標籤:圖形處理/算法
上一篇:請教:如何隱藏某個分裂窗的邊框?
