source: trunk/src/transform_field/remove_background.m @ 40

Last change on this file since 40 was 40, checked in by sommeria, 11 years ago

-relabel_i_j added to the svn (relabel an image series with two indices)
-Menu projection Object added to uvmat, rationalizes the call of projection objects (to improve yet)
-get_plot_handles: modified in relationwith the Menu projection object
-mouse_down: corrected in relation with previous change in field transforms
-transform_field functions added to the svn
-set_object and keyboard_callback: cleaning

File size: 972 bytes
Line 
1function DataOut=remove_particles(DataIn,Calib)
2%-----------------------------------------------
3%parameters
4threshold=200
5nblock_x=30;%size of image subblocks for analysis
6nblock_y=30;
7%---------------------------------------------------------
8DataOut=DataIn;%default
9
10%BACKGROUND LEVEL
11Atype=class(DataIn.A)
12A=double(DataIn.A);
13Backg=zeros(size(A));
14Aflagmin=sparse(imregionalmin(A));%Amin=1 for local image minima
15Amin=A.*Aflagmin;%values of A at local minima
16% local background: find all the local minima in image subblocks
17sumblock= inline('sum(sum(x(:)))');
18Backg=blkproc(Amin,[nblock_y nblock_x],sumblock);% take the sum in  blocks
19Bmin=blkproc(Aflagmin,[nblock_y nblock_x],sumblock);% find the number of minima in blocks
20Backg=Backg./Bmin; % find the average of minima in blocks
21B=imresize(Backg,size(A),'bilinear');% interpolate to the initial size image
22ImPart=(A-B);
23DataOut.A=ImPart.*(ImPart>threshold);
24DataOut.A=feval(Atype,DataOut.A);
Note: See TracBrowser for help on using the repository browser.