Watershed segmentation and counting

  1. Hello. I need to do some plant counting from UAV photography. I was able to get a nice binary image of the plants but some of them are to close to separte and get clustered. I tried the watershed segmentation, but some other smaller plant get also segmented in many pieces. Is there anyway to control the level of segmentation or use other plugin for that?

  2. Also I need to count plants line by line (32 lines total) since each line has a different treatment. Right now I do a selection of each line and do Particle Analysis one by one. Hopefully there are other method that can separate lines and do counting per line.

)Is it posible to save to save the overlay generated from roi counting as a vector or shp format?

Thanks so much

Good day!

re 1:
It would be very helpful if you could post the unprocessed images in the original TIF- or PNG-format.
No JPG-format though, because JPG introduces artifacts!
(Converting a JPG-compressed image to TIFF- or PNG-format doesn’t make sense.)
You may also post images as Zip-archives or make them accessible via a dropbox-like service.

How exactly do you threshold the image to get the binary one.
Please explain the processing in detail!

re 2:
One way to accomplish this is to get separate images from the plant lines and to analyze these. For this purpose it is helpful to properly rotate the image, so that you can use a rectangle selection. Here is, as an example, the top row:

Is it possible to save the overlay generated from roi counting as a vector or shp format?

You can fit a spline to selections (ROIs) but I don’t know what happens if you save these ROIs. Just try it and you will see!

Regards

Herbie

Hello… I did the entire process using a tif file no jpg
First I used a median filter to remove noise, then I applied the dtretch plugin ( decorrelation stretching)
this gives a clear separation between the plants and soil. Used the color treshold, then make it binary
removed noice with Noise-Outliers. Finaly applied the watershed segmentation.
I can do counting by selecting the area with the polygon selection one line at the time. think it is easier than cuting line by line.

this is the image after decorrelation prior to tresholding

The rar-archive is damaged. Please up-load the image again!

In your original post you were asking:

Right now I do a selection of each line and do Particle Analysis one by one. Hopefully there are other method that can separate lines and do counting per line.
(my emphasis)

This is exactly what I’ve suggesated.

Now you write:

I can do counting by selecting the area with the polygon selection one line at the time. think it is easier than cuting line by line.
(my emphasis)

I don’t really understand what you like to obtain.

My approach does what you were asking for and it may be automatically performed by using a macro. However, the main problem needs to be solved before, namely segmentation.

Without seeing the original image I can’t help.

Regards

Herbie

Thanks Herbie

I uploaded again as zip. Hope you can download without problems

https://drive.google.com/open?id=14uyYCf4dfty01aLlwPCjYzUCwPsflwS7

Thanks for the image access!

Here is what I could obtain without any hand-set parameters and without watershed:

This is your result with watershed for comparison:

Please note that if you would extract the lines as separate images you can use the “Analyze Particles…”-functionality for counting. It lets you exclude spots that are outside a defined size range.

Please report back how you judge the above binarization result.

Remarks concening your original image stack:

  1. The 4th color channel contains no information. It can be deleted.
  2. The 1st color channel is slightly over-exposed. It doesn’t harm my approach.
  3. The channels contain 8bit information only. There is no need to use a 16bit stack.

Regards

Herbie

Thanks Herbie. Your aproach look cleaner and more defined. Can you tell me your aproach so I can test it.
Thanks again

Can you tell me your aproach so I can test it.

For whom do you work?

Regards

Herbie

I work for University of Comahue Argentina.

OK, here are the processing steps but please be aware of the fact that I can’t tell how my approach generalizes because I’ve seen your sample image only

  1. Open the 4 channel image stack in ImageJ
  2. Delete channels 2 and 4
  3. In the “Brightness/Contrast”-dialog click “Set”, enter 0 to 255, and click “Propagate to the other…”
  4. Set Image type to 8-bit
  5. Make a Z-Projection of the two channels with “Min intensity”-setting
  6. Apply an “FFT Bandpass Filter” with “large structure” 80, “small structure 0”, and uncheck everything else
  7. Apply a “Median Filter” of size 15
  8. In the “Threshold”-dialog set the automatic threshold scheme to “Default” and uncheck everything else
    (Never set thresholds manually because it leads to difficulties with reproducibility. If the Default scheme doesn’t suit your needs, choose another automatic scheme. If none works for you, you need a custom scheme, which is possible but needs some coding.)
  9. Click “Apply” in the “Threshold”-dialog

You’re done.

HTH

Herbie

Ok… I got it I managed to replicate it.
Thanks so much for your advice! By the way this is part of a project on Restoration ecology.

Good to know that you could replicate the processing steps.

It is rather easy to create a corresponding ImageJ-macro by using the “Macro Recorder”-functionality of ImageJ. This may be useful in case you have to process many images of the same kind.

By the way this is part of a project on Restoration ecology.

Yes, I got the impression when I received the original image. The landscape looks desert-like and similar to areas I know from the Sahel.

Good luck for the project

Herbie