Re: [scikit-image] statistical region merging
Hi Juan, thank you very much for this detailed explanation and your suggestions. I just had a quick try with the merge_hierarchical example. If I use the code which I attached the results look more like expected. In addition, I will test your others suggestions also in terms of speed (I have to segment many images). Thanks again for your effort! Stefanie 2016-11-15 23:55 GMT+01:00 Juan Nunez-Iglesias <jni.soma@gmail.com>:
Hi Stefanie,
Wow, those results *do* look weird! =) Why are they not the same shape as the image? Could you send us the complete code you used?
In the meantime, there's a few things to change. `cut_threshold` is probably the single most fragile algorithm you can use with a RAG. You want to be using merge_hierarchical. You can do this either on a "color graph", which merges regions according to color similarity (and is most similar to the statistical region merging of Fiji): http://scikit-image.org/docs/dev/auto_examples/ segmentation/plot_rag_merge.html#sphx-glr-auto-examples- segmentation-plot-rag-merge-py
or on a *boundary graph*, which first detects "edges" in the image and then merges regions progressively according to the mean edge value: http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_ boundary.html#sphx-glr-auto-examples-segmentation-plot-rag-boundary-py
http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_boundary_ merge.html#sphx-glr-auto-examples-segmentation-plot-boundary-merge-py
My intuition about this image is that your best choice is to use a sobel filter: http://scikit-image.org/docs/dev/auto_examples/edges/plot_ edge_filter.html#sphx-glr-auto-examples-edges-plot-edge-filter-py followed by compact watershed: http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_compact_ watershed.html#sphx-glr-auto-examples-segmentation-plot- compact-watershed-py then by region boundary merging: http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_boundary_ merge.html#sphx-glr-auto-examples-segmentation-plot-boundary-merge-py
The edges look pretty sharp, too. You might even get good results with Canny: http://scikit-image.org/docs/dev/auto_examples/edges/plot_ canny.html#sphx-glr-auto-examples-edges-plot-canny-py
I hope all this helps!
Juan.
On 15 November 2016 at 7:11:14 pm, Stefanie Lück (luecks@gmail.com) wrote:
Dear all,
sorry about the worse problem description! I tried this example <http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_mean_co...> with different parameters for SLIC and graph.cut_threshold but none of them gave me satisfying results.
I attached the original image, the ImageJ SRM (Q=25) output and the RAG output (segmentation.slic(img, compactness=20; n_segments=400), graph.cut_threshold(labels1, g, 10))
The results are quite different, obviously I am doing something wrong. My aim is to segment each leaf separately. At the moment I am using felzenszwalb, which gives me quite reasonable results. However I would like to try everything possible and therefore I would appreciate some tips.
Thank you for the explanation of the algorithm, that was helpful.
Best regards, Stefanie
2016-11-15 1:51 GMT+01:00 Juan Nunez-Iglesias <jni.soma@gmail.com>:
Hi Stefanie,
Sorry, these responses should all be CCd to the list, so that others can benefit from the discussion — my bad for dropping that thread. Could you please:
- provide an example segmentation where skimage is doing worse than Fiji - provide the script and parameter settings for both
Then we can help troubleshoot. I don’t know what you mean by the results “were very strange”, for example, so it’s hard to diagnose the problem. =)
Starting to merge directly from pixels, as the Fiji plugin does, is expensive and can be error prone. SLIC is a fast, initial pixel merging step, from which we can merge regions according to various criteria. With the right parameters, SLIC + RAG mean color agglomeration should give quite similar results to Fiji’s approach…
Juan.
On 15 November 2016 at 2:39:45 am, Stefanie Lück (luecks@gmail.com) wrote:
Hi Juan,
thank you for your reply! I have seen and tested the RAG examples but I did not understand the SLIC step and the results were very strange... Is there any advantage? I am using SLIC anyway at the moment but the statistical region merging of ImageJ gives me better results.
Thanks Stefanie
2016-11-14 13:44 GMT+01:00 Juan Nunez-Iglesias <jni.soma@gmail.com>:
Hi Stefanie!
Have a look at skimage.future.graph! There are some relevant examples in the gallery, too:
http://scikit-image.org/docs/dev/auto_examples/#segmentation-of-objects
The future.graph API is still experimental (that’s why it’s in “future”), so we really appreciate any feedback you have about it!
Juan.
On 14 November 2016 at 8:21:12 pm, Stefanie Lück (luecks@gmail.com) wrote:
Hi!
I am looking for a statistical region merging segmentation. Is there anything like this in skimage?
Thanks in advance, Stefanie _______________________________________________ scikit-image mailing list scikit-image@python.org https://mail.python.org/mailman/listinfo/scikit-image
participants (1)
-
Stefanie Lück