Last change
on this file since 412 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:
1.1 KB
|
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 | if ~isfield(DataIn,'A')
|
---|
11 | DataOut.Txt='remove_particels only valid for input images';
|
---|
12 | return
|
---|
13 | end
|
---|
14 |
|
---|
15 | %BACKGROUND LEVEL
|
---|
16 | Atype=class(DataIn.A);
|
---|
17 | A=double(DataIn.A);
|
---|
18 | Backg=zeros(size(A));
|
---|
19 | Aflagmin=sparse(imregionalmin(A));%Amin=1 for local image minima
|
---|
20 | Amin=A.*Aflagmin;%values of A at local minima
|
---|
21 | % local background: find all the local minima in image subblocks
|
---|
22 | sumblock= inline('sum(sum(x(:)))');
|
---|
23 | Backg=blkproc(Amin,[nblock_y nblock_x],sumblock);% take the sum in blocks
|
---|
24 | Bmin=blkproc(Aflagmin,[nblock_y nblock_x],sumblock);% find the number of minima in blocks
|
---|
25 | Backg=Backg./Bmin; % find the average of minima in blocks
|
---|
26 | B=imresize(Backg,size(A),'bilinear');% interpolate to the initial size image
|
---|
27 | ImPart=(A-B);
|
---|
28 | ImPart=ImPart.*(ImPart>threshold);
|
---|
29 | DataOut.A=A-ImPart;%
|
---|
30 | DataOut.A=feval(Atype,DataOut.A);
|
---|
31 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.