四种简单的图像显著性区域特征提取方法-----> AC/HC/LC/FT。

四种简单的图像显著性区域特征提取方法-----> AC/HC/LC/FT。

分类: 图像处理 2014-08-03 12:40 4088人阅读 评论(4) 收藏 举报

salient region detec显著性检测

laviewpbt  2014.8.3 编辑

Email:laviewpbt@sina.com   QQ:33184777

最近闲来蛋痛,看了一些显著性检测的文章,只是简单的看看,并没有深入的研究,以下将研究的一些收获和经验共享。

     先从最简单的最容易实现的算法说起吧:

1、 LC算法

参考论文:Visual Attention Detection in Video Sequences Using Spatiotemporal Cues。 Yun Zhai and Mubarak Shah.  Page 4-5。

    算法原理部分见论文的第四第五页。

      When viewers watch a video sequence, they are attracted not only by the interesting events, but also sometimes by the interesting objects in still images. This is referred as the spatial attention. Based on the psychological studies, human perception system is sensitive to the contrast of visual signals, such as color, intensity and texture. Taking this as the underlying assumption, we propose an e±cient method for computing the spatial saliency maps using the color statistics of images. The algorithm is designed with a linear computational complexity with respect to the number of image pixels. The saliency map of an image is built upon the color contrast between image pixels. The saliency value of a pixel Ik in an image I is defined as,

05422908335

     where the value of Ii is in the range of [0; 255], and || * ||represent the color distance metric。

要实现这个算法,只要有这个公式(7)就完全足够了。就是每个像素的显著性值是其和图像中其他的所有像素的某个距离的总和,这个距离一般使用欧式距离。

如果采用直接的公式定义,则算法的时间复杂度很高,这个的优化不用想就知道是直方图,我都懒得说了。

     注意这篇文章采用的一个像素的灰度值来作为显著性计算的依据。这样图像最多的像素值只有256种了。

     该算法的代码在HC对应的文章的附带代码里有,我这里贴出我自己的实现:

extern void Normalize(float *DistMap, unsigned char *SaliencyMap, int Width, int Height, int Stride, int Method = 0);

/// <summary>
/// 实现功能: 基于SPATIAL ATTENTION MODEL的图像显著性检测
///    参考论文: Visual Attention Detection in Video Sequences Using Spatiotemporal Cues。 Yun Zhai and Mubarak Shah.  Page 4-5。
///    整理时间: 2014.8.2
/// </summary>
/// <param name="Src">需要进行检测的图像数据,只支持24位图像。</param>
/// <param name="SaliencyMap">输出的显著性图像,也是24位的。</param>
/// <param name="Width">输入的彩色数据的对应的灰度数据。</param>
/// <param name="Height">输入图像数据的高度。</param>
/// <param name="Stride">图像的扫描行大小。</param>
/// <remarks> 基于像素灰度值进行的统计。</remarks>

void __stdcall SalientRegionDetectionBasedonLC(unsigned char *Src, unsigned char *SaliencyMap, int Width, int Height, int Stride)
{
    int X, Y, Index, CurIndex ,Value;
    unsigned char *Gray = (unsigned char*)malloc(Width * Height);
    int *Dist = (int *)malloc(256 * sizeof(int));
    int *HistGram = (int *)malloc(256 * sizeof(int));
    float *DistMap = (float *) malloc(Height * Width * sizeof(float));

    memset(HistGram, 0, 256 * sizeof(int));

    for (Y = 0; Y < Height; Y++)
    {
        Index = Y * Stride;
        CurIndex = Y * Width;
        for (X = 0; X < Width; X++)
        {
            Value = (Src[Index] + Src[Index + 1] * 2 + Src[Index + 2]) / 4;        //    保留灰度值,以便不需要重复计算
            HistGram[Value] ++;
            Gray[CurIndex] = Value;
            Index += 3;
            CurIndex ++;
        }
    }

    for (Y = 0; Y < 256; Y++)
    {
        Value = 0;
        for (X = 0; X < 256; X++) 
            Value += abs(Y - X) * HistGram[X];                //    论文公式(9),灰度的距离只有绝对值,这里其实可以优化速度,但计算量不大,没必要了
        Dist[Y] = Value;
    }
    
    for (Y = 0; Y < Height; Y++)
    {
        CurIndex = Y * Width;
        for (X = 0; X < Width; X++)
        {
            DistMap[CurIndex] = Dist[Gray[CurIndex]];        //    计算全图每个像素的显著性
            CurIndex ++;
        }
    }

    Normalize(DistMap, SaliencyMap, Width, Height, Stride);    //    归一化图像数据

    free(Gray);
    free(Dist);
    free(HistGram);
    free(DistMap);
}

算法效果:

17349305620 017509467095

20077122578 020203378154

21413684965021511498244

  • 3
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值