Ignore:
Timestamp:
Feb 25, 2015, 12:02:38 AM (9 years ago)
Author:
sommeria
Message:

bugs corrected in stereo_civ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_series.m

    r878 r879  
    958958MinA=min(min(par_civ.ImageA));
    959959%MinB=min(min(par_civ.ImageB));
    960 check_undefined=false(size(par_civ.ImageA));
     960%check_undefined=false(size(par_civ.ImageA));
    961961if isfield(par_civ,'Mask') && ~isempty(par_civ.Mask)
    962962    checkmask=1;
     
    990990        image1_crop=MinA*ones(numel(subrange1_y),numel(subrange1_x));% default value=min of image A
    991991        image2_crop=MinA*ones(numel(subrange2_y),numel(subrange2_x));% default value=min of image A
    992         mask1_crop=ones(numel(subrange1_y),numel(subrange1_x));% default value=1 for mask
    993         mask2_crop=ones(numel(subrange2_y),numel(subrange2_x));% default value=1 for mask
    994992        check1_x=subrange1_x>=1 & subrange1_x<=par_civ.ImageWidth;% check which points in the subimage 1 are contained in the initial image 1
    995993        check1_y=subrange1_y>=1 & subrange1_y<=par_civ.ImageHeight;
     
    998996        image1_crop(check1_y,check1_x)=par_civ.ImageA(subrange1_y(check1_y),subrange1_x(check1_x));%extract a subimage (correlation box) from image A
    999997        image2_crop(check2_y,check2_x)=par_civ.ImageB(subrange2_y(check2_y),subrange2_x(check2_x));%extract a larger subimage (search box) from image B
    1000         mask1_crop(check1_y,check1_x)=check_undefined(subrange1_y(check1_y),subrange1_x(check1_x));%extract a mask subimage (correlation box) from image A
    1001         mask2_crop(check2_y,check2_x)=check_undefined(subrange2_y(check2_y),subrange2_x(check2_x));%extract a mask subimage (search box) from image B
    1002         sizemask=sum(sum(mask1_crop))/(numel(subrange1_y)*numel(subrange1_x));%size of the masked part relative to the correlation sub-image
    1003         if sizemask > 1/2% eliminate point if more than half of the correlation box is masked
    1004             F(ivec)=3; %
     998        if checkmask
     999            mask1_crop=ones(numel(subrange1_y),numel(subrange1_x));% default value=1 for mask
     1000            mask2_crop=ones(numel(subrange2_y),numel(subrange2_x));% default value=1 for mask
     1001            mask1_crop(check1_y,check1_x)=check_undefined(subrange1_y(check1_y),subrange1_x(check1_x));%extract a mask subimage (correlation box) from image A
     1002            mask2_crop(check2_y,check2_x)=check_undefined(subrange2_y(check2_y),subrange2_x(check2_x));%extract a mask subimage (search box) from image B
     1003            sizemask=sum(sum(mask1_crop))/(numel(subrange1_y)*numel(subrange1_x));%size of the masked part relative to the correlation sub-image
     1004            if sizemask > 1/2% eliminate point if more than half of the correlation box is masked
     1005                F(ivec)=3; %
     1006            else
     1007                image1_crop=image1_crop.*~mask1_crop;% put to zero the masked pixels (mask1_crop='true'=1)
     1008                image2_crop=image2_crop.*~mask2_crop;
     1009                image1_mean=mean(mean(image1_crop))/(1-sizemask);
     1010                image2_mean=mean(mean(image2_crop))/(1-sizemask);
     1011            end
    10051012        else
    1006             image1_crop=image1_crop.*~mask1_crop;% put to zero the masked pixels (mask1_crop='true'=1)
    1007             image2_crop=image2_crop.*~mask2_crop;
    1008             image1_mean=mean(mean(image1_crop))/(1-sizemask);
    1009             image2_mean=mean(mean(image2_crop))/(1-sizemask);
    1010             %threshold on image minimum
    1011             if check_MinIma && (image1_mean < par_civ.MinIma || image2_mean < par_civ.MinIma)
    1012                 F(ivec)=3;
    1013             end
    1014             %threshold on image maximum
    1015             if check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma)
    1016                 F(ivec)=3;
    1017             end
    1018         end
     1013            image1_mean=mean(mean(image1_crop));
     1014            image2_mean=mean(mean(image2_crop));
     1015        end
     1016        %threshold on image minimum
     1017        if check_MinIma && (image1_mean < par_civ.MinIma || image2_mean < par_civ.MinIma)
     1018            F(ivec)=3;
     1019        end
     1020        %threshold on image maximum
     1021        if check_MaxIma && (image1_mean > par_civ.MaxIma || image2_mean > par_civ.MaxIma)
     1022            F(ivec)=3;
     1023        end
     1024       
    10191025        if F(ivec)~=3
    1020             image1_crop=(image1_crop-image1_mean).*~mask1_crop;%substract the mean, put to zero the masked parts
    1021             image2_crop=(image2_crop-image2_mean).*~mask2_crop;
     1026            if checkmask
     1027                image1_crop=(image1_crop-image1_mean).*~mask1_crop;%substract the mean, put to zero the masked parts
     1028                image2_crop=(image2_crop-image2_mean).*~mask2_crop;
     1029            else
     1030                image1_crop=(image1_crop-image1_mean);
     1031                image2_crop=(image2_crop-image2_mean);
     1032            end
    10221033            if CheckDeformation
    10231034                xi=(1:mesh:size(image1_crop,2));
Note: See TracChangeset for help on using the changeset viewer.