Calculating Leaf Area, Leaf width and length from ordinary scans     




Lafore is a tool for image classification especially designed
for plant leaf investigations and seed counting.
It calculates leaf area, length and width or number of seeds.

Current research activities require the recording of plant traits such as Leaf Area, or Seed number to build up databases for many species.
Commercial available leaf scan devices are expensive and their handling is (sometimes) poor. The results of some of these scanning devices are not replicable since the scan is not stored.
However ordinary scanner became cheep, lightweight, fast and generally available. If they are combined with a Notebook they make up a good field device already without spending extra money.
The scanned Leafs can be analysed with LAFORE.

It calculates the leaf area, leaf width, and leaf length and can handle several leafs at once. 

Lafore simply couts the pixel that are darker than a reference value that can be set using the lower right scrollbar. The number of pixels is multiplied with the size of one pixel. Pixel height and width (scan resolution) have to be known.

Scan resolution
Lafore is no scan tool. The scanning itself has to be performed prior classification
The scan resolution should be set to a value, that allows to recognise all important features of the leaf if viewed with an ordinary graphics program. The program counts pixels, hence less pixel result in a less accuracy. However, big  files may cause problems on some computers and take longer to scan. If the pixel size is 0.254  (100 dpi) a leaf of  5 mm* 1mm has 5 mm²/0.254mm²=77.5 pixel. Whether this is enough depends on the required accuracy.
Below is a list of the scan resolutions that I use:
Leaf size        dpi
>1cm²           100
0.5 cm²         300
<5 mm²         600
If small leafs are scanned do not scan the whole area, but select a smaller size to limit the file size.

Lafore has cost me a lot of time. Since using our leaf scan device is much slower, not programming it would have cost me even more time.
Lafore is free for scientific uses. If its results are published, a proper citation would be appreciated.

I'm still trying to make it more comfortable or incorporate bugfixes. If it does not work properly please send me a bug description. If a certain scan is not properly classified please enclose it (compact it!!) so I can have a look at the problem.


Copyright by Veiko Lehsten
Landscape Ecology Group (Fac. 5)
University of Oldenburg
PO Box 2503
D-26111 Oldenburg
Tel.       0049 (0) 441 798 3914
Fax.      0049 (0) 441 798 3914


For a first installation, run the installation file.
It will extract all files to C:Lafore                         DONT CHANGE THE DIRECTORY

Visual (short) Manual:
1: Scan leaf (using your scan program)

2:Load scan in Lafore -> <Load Picture>, leaf should be displayed:

Type either the printer resolution, or the Pixel Height and Length
which is approx.  25.4(mm)/ printer resolution,
e.g. if the leaf is scanned with 100 dpi -> 25.4/100=0.254 type 0.254 (use the dot(.), not the comma(,)!)
or use the <Calibrate> function (see below)

Push <Classify Picture>

The Area and extent is listed in the Listfield.
If several leafs are on the scan, they are numbered in the display.


Hardware and Software requirements:

IBM PC with appropriate speed and memory
20 MB free space on drive C.

Windows 98/NT4.0/XP or higher.

Run the installafore.exe.
The installation routine will create a folder C: Lafore.
Lafore to C:. The program needs some files (dll's) to be in a specific position therefore the
folder has to be directly there.
Execute lafore.exe.


General steps:
1. Scan Leafs/Seeds with any scanning tool
2. Calibrate Lafore
3. Test brightness (if necessary)
4. Classify image (single picture/whole folder)
5.Type/Load the data into your data sheet (e.g. Excel)

Before using Lafore, the leafs or seeds have to be already scanned,
Lafore is no scanning tool. The image types .tif, .bmp and jpg  are recognized, .tif is the standard file type.
Make sure you follow the requirements of appropriate processing of the leafs (e.g. watering) or seeds (e.g. cleaning). Make sure that the scanning resolution is high enough for the classification of small leafs. The leafs/seeds have to be easy recognizable on the image.

Before using Lafore, the pixel size or the scanner resolutions has to be set. You can either simply type scanning resolution in dot per inch, or the pixel height and width of the scanned picture, if known, or if you don't know the exact scanning resolution  let Lafore calculate the pixel size in the following way:
Scan any object from which you know  the exact width and height (e.g. a coin).
Press <Calibrate> (the fields pixel height and width have to be set to 0 before).
Choose the image containing the scanned object in the following dialog box.
Type in the object height and width in the appropriate fields.
Press <Do calibration> again. The picture should now change its color and the actual pixel size and height is displayed. The program is now calibrated.
Repeat this any time the resolution of the pictures changes. 
The values for the actual pixel size can be saved by pressing <Save cal> and specifying a file name. If you are using the same scanner on the same resolution again you can load the value by pressing <Load cal>.
To classify an image you have to load it first by pressing <Load picture> and then press <Classify picture>. The colors of the picture change according to the recognized leafs.
If you can't distinguish the leafs clearly you can change the brightness with the scrollbar on the right bottom and classify them again.
If there is dust on the image, set the minimum size of objects to be recognized with the scrollbar on the left bottom.
The classification is done by comparing the brightness of the leaf with the background. If you have very bright leafs, you might use a dark sheet as background and invert the image in any photo processing program before classification. I never had this problem, therefore this function is not included, but if this becomes a problem, write me an e-mail and I can include this feature.

NOTE: The minimum size of objects is set to 1 mm*mm by default, you may have to lower this for small leafs or seeds.

The values for the leafs are displayed:  (counted from up-left to down-right)
Area: area of the leaf
BX: width of the rectangular box that could be drawn about the leaf
BY: height of the rectangular box that could be drawn about the leaf
If you want to use BX and BY as leaf length and width, make sure the leafs are placed properly.

You can classify all pictures in a folder by pressing <Folder for all>, double click on one of the images in the folder and choose a place and name for the output file which will contain all data. Be careful with these option and control the values after wards. I found out, that sometimes the lid of the scanner was not closed properly or due to other reasons the brightness has to be readjusted for some leafs.   
The data from this new file can either be opened by any word-processing program (e.g. Notepad) or loaded directly into a data sheet. The values are separated by semicolons and the first two lines are the column header.
The first field contains the folder of the image, the second contains the name of the classified picture and the following fields the Area, BX and BY values of all leafs in the image.
All values are in the same unit as the pixel height and width.

For seed counting you can disperse the seeds on the scanner (use a transparency below and above), load the image and press <Count Objects>.
Make sure you set the minimum size of objects to the appropriate value.

The program Lafore comes as it is, no warranty of any kind can be taken.

If you have any questions about it's function, suggestions for further development or find any bugs, please report them to: (veiko.lehsteponbn@uols/y.dehn)

Landj4deco-Webmastenvk4r (helggjga.hw5ots@uogv9q/l.deu071j) (Changed: 2020-01-23)