• 大小: 1.06MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-12
  • 语言: 其他
  • 标签:

资源简介

静态阴影去除 静态阴影去除 静态阴影去除 静态阴影去除

资源截图

代码片段和文件信息

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function shadowSegmentFeatures = computeShadowSegmentFeatures(img seg varargin)
%  Computes features on the segments (superpixels) of the image (used only for the CRF).
%
% Input parameters:
%  - img: input image
%  - seg: image segmentation
%
% Output parameters:
%  - shadowSegmentFeatures: segment features
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function shadowSegmentFeatures = computeShadowSegmentFeatures(img seg varargin)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright 2006-2010 Jean-Francois Lalonde
% Carnegie Mellon University
% Consult the LICENSE.txt file for licensing information
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%% Parse arguments
defaultArgs = struct(‘Verbose‘ 0 ‘InvRespFunction‘ [] ...
    ‘RGBHist‘ 0 ‘HistNbBins‘ 4 ‘Normalize‘ 0 ‘Equalize‘ 0);
args = parseargs(defaultArgs varargin{:});

shadowSegmentFeatures = [];
tic;

%% Correct image for inverse response function
if ~isempty(args.InvRespFunction)
    myfprintf(args.Verbose ‘Applying inverse response function...‘);
    img = correctImage(img args.InvRespFunction);
end
imgPx = reshape(img size(img1)*size(img2) size(img3));

segId = 1:max(seg(:));
segIdToPxId = arrayfun(@(x) find(seg==x) segId ‘UniformOutput‘ 0);

%% Compute RGB histogram
if args.RGBHist
    myfprintf(args.Verbose ‘Computing RGB histogram...‘);
    histEdges = linspace(0 1 args.HistNbBins+1); histEdges(end) = histEdges(end)+eps;
    histImg = cellfun(@(x) histc(imgPx(x:) histEdges 1) segIdToPxId ‘UniformOutput‘ 0);
    histImg = cat(3 histImg{:});
    
    % drop last dimension
    histImg = histImg(1:end-1 : :);
    
    % normalize
    histImg = histImg./repmat(sum(histImg 1) [size(histImg 1) 1 1]);
    
    % reshape: [R1 G1 B1 R2 G2 B2 ...]
    shadowSegmentFeatures.RGBHist.hist = reshape(permute(histImg [3 2 1]) size(histImg 3) size(histImg2)*size(histImg1));
    
    % compute mean as well
    meanImg = cellfun(@(x) mean(imgPx(x:) 1) segIdToPxId ‘UniformOutput‘ 0);
    shadowSegmentFeatures.RGBHist.mean = cat(1 meanImg{:});
    
    if args.Normalize
        myfprintf(args.Verbose ‘Computing normalized features...‘);
        % subtract mean divide by stdev
        meanSegmentColor = mean(shadowSegmentFeatures.RGBHist.mean 1);
        stdSegmentColor = std(shadowSegmentFeatures.RGBHist.mean 1);
        
        imgPxNew = imgPx - repmat(meanSegmentColor size(imgPx 1) 1);
        imgPxNew = imgPxNew ./ repmat(stdSegmentColor size(imgPx 1) 1);
        % re-center and rescale in [01] interval
        imgPxNew = imgPxNew + 0.5;
        imgPxNew = (imgPxNew - min(imgPxNew(:))) ./ (max(imgPxNew(:))-min(imgPxNew(:)));
        imgNew = reshape(imgPxNew size(img));
        
        tmpFeatures = computeShadowSegmentFeatures(imgNew segIdToPxId ‘RGBHist‘ 1 ‘Hist

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-05-24 03:11  DIP-PJ-master\
     文件       10244  2017-05-24 03:11  DIP-PJ-master\.DS_Store
     文件          40  2017-05-24 03:11  DIP-PJ-master\README.md
     文件        3738  2017-05-24 03:11  DIP-PJ-master\computeShadowSegmentFeatures.m
     文件         807  2017-05-24 03:11  DIP-PJ-master\convertBoundariesToPxInd.m
     文件         713  2017-05-24 03:11  DIP-PJ-master\convertDataFile.m
     目录           0  2017-05-24 03:11  DIP-PJ-master\data\
     文件        6148  2017-05-24 03:11  DIP-PJ-master\data\.DS_Store
     文件      258480  2017-05-24 03:11  DIP-PJ-master\data\bdt-eccv10-with-statistics-toolbox.mat
     文件      468425  2017-05-24 03:11  DIP-PJ-master\data\bdt-eccv10.mat
     文件      111205  2017-05-24 03:11  DIP-PJ-master\data\filterBank.mat
     目录           0  2017-05-24 03:11  DIP-PJ-master\data\img\
     文件      204478  2017-05-24 03:11  DIP-PJ-master\data\img\img-groundProb.mat
     文件       97774  2017-05-24 03:11  DIP-PJ-master\data\img\img.jpg
     文件       47492  2017-05-24 03:11  DIP-PJ-master\data\univTextons_128.mat
     文件        3518  2017-05-24 03:11  DIP-PJ-master\demoShadowDetection.m
     目录           0  2017-05-24 03:11  DIP-PJ-master\display\
     文件         727  2017-05-24 03:11  DIP-PJ-master\display\displayBoundaries.m
     文件        1124  2017-05-24 03:11  DIP-PJ-master\display\displayBoundariesProb.m
     文件        1656  2017-05-24 03:11  DIP-PJ-master\extractImageBoundaries.m
     文件        2298  2017-05-24 03:11  DIP-PJ-master\getBoundaryIndicesFromEdges.m
     文件        1767  2017-05-24 03:11  DIP-PJ-master\getPathName.m
     文件         444  2017-05-24 03:11  DIP-PJ-master\grad2wseg.m
     文件         814  2017-05-24 03:11  DIP-PJ-master\interpBoundarySubPixel.m
     文件         304  2017-05-24 03:11  DIP-PJ-master\myfprintf.m
     文件        6292  2017-05-24 03:11  DIP-PJ-master\selectBoundaryFeatures.m
     文件         444  2017-05-24 03:11  DIP-PJ-master\selectImageFeatures.m
     文件         811  2017-05-24 03:11  DIP-PJ-master\setPath.m
     文件        6941  2017-05-24 03:11  DIP-PJ-master\shadow_removal.m
     文件         131  2017-05-24 03:11  DIP-PJ-master\skewness.m

评论

共有 条评论

相关资源