fanalyze

Creating focusV and stepV vectors by analyzing a set of images.

Contents

Syntax

[focusV,stepV]=fanalyze(basePath)

[focusV,stepV]=fanalyze(..., ' PropertyName ', 'PropertyValue',...)

Description

[focusV,stepV]=fanalyze(basePath) creates stepV and focusV for the images in basePath.

[focusV,stepV]=fanalyze(..., ' PropertyName ', 'PropertyValue',...) manipulates analysis characteristic by setting the fanalyze-properties. Enter properties as one or more name-value pairs.

Options

This section provides a description of properties. Curly braces { } enclose default values

extension
{'jpg'}
Specifies the image type used by its file extension. For possible values are for example:
  • jpg
  • png
  • bmp
For more details see imread.
colwidth / rowheight
{100}
For analysis the image is cut into rectangles of the size colwidth times rowheight
method
{GRAS}
fanalyze provides multiple methods for focal analysis. For more details see ... or fmeasure on matlabcentral.
directoryMask
{[]}
Instead of using analyzing every image in basepath only certain images can be used. For details see ...
roi
{[0,0,image width, image height]}
If only a small portion of the image is of interest, an region of interest can be specified. Please keep in mind that if and roi is used here, fplot3 may also need it.

Methods

For focal analysis fmeasure by Said Pertuz was used. It provides numerous methods and it is highly recommended to use of of the following:

$$F = \frac{1}{n_x\cdot n_y}\sum_x\sum_y |I_{x,y} - I_{x+1,y}|^2 $$

$$ F = \frac{1}{n_x\cdot n_y}\sum_x\sum_y |I_{x,y} - I_{x+2,y}|^2 $$

Since GRAS yielded very good results, it is the default valu.

Directory mask

If set only those images where directoryMask is one are used.

Therefore the input files are listed

inputFiles = dir(strcat(basePath, '*.', extension));

and compared against directoryMask

inputFiles=inputFiles(directoryMask==1);

Examples

Assume you have the following content in basePath:

dir(basePath)
-100.jpg  -240.jpg  -40.jpg   -540.jpg  -680.jpg  -820.jpg  120.jpg   
-120.jpg  -260.jpg  -400.jpg  -560.jpg  -700.jpg  -840.jpg  20.jpg    
-140.jpg  -280.jpg  -420.jpg  -580.jpg  -720.jpg  -860.jpg  40.jpg    
-160.jpg  -300.jpg  -440.jpg  -60.jpg   -740.jpg  -880.jpg  60.jpg    
-180.jpg  -320.jpg  -460.jpg  -600.jpg  -760.jpg  .         80.jpg    
-20.jpg   -340.jpg  -480.jpg  -620.jpg  -780.jpg  ..        
-200.jpg  -360.jpg  -500.jpg  -640.jpg  -80.jpg   0.jpg     
-220.jpg  -380.jpg  -520.jpg  -660.jpg  -800.jpg  100.jpg   

Basic example (default parameters) using all images:

[focusV,stepV]=fanalyze(basePath);

Example with directory mask.

directoryMask = [true false true false true false true false true false true];
[focusV,stepV]=fanalyze(basePath, 'directoryMask',directoryMask);

will only use these images:

-370.jpg
-380.jpg
-390.jpg
-400.jpg
-410.jpg
-420.jpg