写在前面
最近在做毕设,题目是行人再识别。目前只是用行人区域的颜色直方图进行匹配,效果比较不理想。老板推荐加入显著性检测,然后就搞了搞。
环境
- VS2015
- OpenCV3.2
代码
Saliency_h
// Saliency.h: interface for the Saliency class.
//
//////////////////////////////////////////////////////////////////////
//===========================================================================
// Copyright (c) 2009 Radhakrishna Achanta [EPFL]
//===========================================================================
#if !defined(_SALIENCY_H_INCLUDED_)
#define _SALIENCY_H_INCLUDED_
#include <vector>
#include <cfloat>
using namespace std;
class Saliency
{
public:
Saliency();
virtual ~Saliency();
public:
void GetSaliencyMap(
const vector<unsigned int>& inputimg,//INPUT: ARGB buffer in row-major order
const int& width,
const int& height,
vector<double>& salmap,//OUTPUT: Floating point buffer in row-major order
const bool& normalizeflag = true);//false if normalization is not needed
private:
void RGB2LAB(
const vector<unsigned int>& ubuff,
vector<double>& lvec,
vector<double>& avec,
vector<double>& bvec);
void GaussianSmooth(
const vector<double>& inputImg,
const int& width,
const int& height,
const vector<double>& kernel,
vector<double>& smoothImg);
//==============================================================================
/// Normalize
//==============================================================================
void Normalize(
const vector<double>& input,
const int& width,
const int& height,
vector<double>& output,
const int& normrange = 255)
{
double maxval(0);
double

本文介绍在行人再识别项目中应用OpenCV进行显著性检测的方法。通过VS2015和OpenCV3.2环境,实现了从ARGB图像到显著性区域的转换。主要代码包括Saliency_h、Saliency_cpp和Main_cpp。文中还提到将32位无符号整数ARGB图像数据转换为程序所需格式,并讨论了转换后数据的一维表示。最后展示了原图像和显著性区域的检测结果。
最低0.47元/天 解锁文章
2064

被折叠的 条评论
为什么被折叠?



