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