[转]国外的一个图像显著区域检测代码及其效果图 saliency region detection

这篇博客分享了国外一个关于图像显著区域检测的代码,包括几幅处理效果图。作者提供了可以直接测试的代码,并指出该代码源自EPFL的主页。此外,还提到了清华大学在此领域的最新研究成果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://blog.youkuaiyun.com/onezeros/archive/2011/04/03/6299745.aspx

原创  国外的一个图像显著区域检测代码及其效果图 saliency region detection

先看几张效果图吧

效果图:

可以直接测试的代码:

头文件:

// Saliency.h: interface for the Saliency class.  
//  
//////////////////////////////////////////////////////////////////////  
//===========================================================================  
//  Copyright (c) 2009 Radhakrishna Achanta [EPFL]   
//===========================================================================  
  
#if !defined(_SALIENCY_H_INCLUDED_)  
#define _SALIENCY_H_INCLUDED_  
  
#include 
     
   
#include 
     
   
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 minval(DBL_MAX);  
        {
   
   int i(0);  
        for( int y = 0; y < height; y++ )  
        {  
            for( int x = 0; x < width; x++ )  
            {  
                if( maxval < input[i] ) maxval = input[i];  
                if( minval > input[i] ) minval = input[i];  
                i++;  
            }  
        }}  
        double range = maxval-minval;  
        if( 0 == range ) range = 1;  
        int i(0);  
        output.clear();  
        output.resize(width*height);  
        for( int y = 0; y < height; y++ )  
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值