Re: Thresholding a dark region in an image

Hi Nabil, Have you looked at the skimage.filters.threshold_* functions? I would start by looking at the results from each of those on a few example sunspots to see whether one reliably gives you a reasonable result. Juan. On 20 May 2016 at 12:26:37 AM, Nabil Freij (nabil.freij@gmail.com) wrote: Hello, I have been investigating how to threshold a structure in my images. More specifically, a sunspot, that can be seen in Figure 1. The aim has been to isolate and measure the number of pixels that are part of the central part of a sunspot, which is the darkest region of the structure. The method I have been using is to define a region which contains no features that are similar to a sunspot. The size of this region is not fixed but I generally make it as large as the data allows. This region is at the bottom black box in Figure 1 (ignore the slider). The mean and standard deviation of this region is calculated, which allows me to define a threshold limit, which is subtracting the standard deviation multiplied by a user defined constant from the mean. The constant is chosen so that overall, the threshold is selecting the pixels we know that are part of the central region. But this value varies depending the structure and the data source. Another method I have discussed or looked into are related to Figure 2. On the left is a cropped field of view of the sunspot and on the right is a histogram of this image in red and in yellow is the histogram of the background box from Figure 1. By using the histogram, I can work out the numerical gradient and pick the points with the largest shift. I also tried this method on the original image by taking slices along the sunspot, however, due to the non-uniform nature of a sunspot the results were not very good. I was wondering if there were any suggestions to threshold this region that is not as ad hoc as my method? Thanks, Nabil -- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. To post to this group, send email to scikit-image@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/CADwJ0z1Sthz7OW8uu2G2i%2Bm9Va.... For more options, visit https://groups.google.com/d/optout.

Hi Juan and François, Thanks for those suggestions. So from my understanding, threshold_isodata, threshold_li, threshold_otsu and threshold_yen return values that allow me to threshold an image. Using these on the whole image returns a threshold value which return a value which does a good job of getting the entire sunspot. Which can be seen in Figure 1. Varying the bin size, where possible, changes very little. So I decided to use them on a smaller image that shows just the sunspot and the results are very good as you can see in Figure 2. I will carry on trying the various routines to see what the results are. I used the minimum algorithm when it was merged into scikit master and I have found it to be the most useful in my cases so far. But my current results are very rough. Thanks for all the help! Nabil On 23 May 2016 at 05:34, Juan Nunez-Iglesias <jni.soma@gmail.com> wrote:
Hi Nabil,
Have you looked at the skimage.filters.threshold_* functions? I would start by looking at the results from each of those on a few example sunspots to see whether one reliably gives you a reasonable result.
Juan.
On 20 May 2016 at 12:26:37 AM, Nabil Freij (nabil.freij@gmail.com) wrote:
Hello,
I have been investigating how to threshold a structure in my images. More specifically, a sunspot, that can be seen in Figure 1. The aim has been to isolate and measure the number of pixels that are part of the central part of a sunspot, which is the darkest region of the structure.
The method I have been using is to define a region which contains no features that are similar to a sunspot. The size of this region is not fixed but I generally make it as large as the data allows. This region is at the bottom black box in Figure 1 (ignore the slider). The mean and standard deviation of this region is calculated, which allows me to define a threshold limit, which is subtracting the standard deviation multiplied by a user defined constant from the mean. The constant is chosen so that overall, the threshold is selecting the pixels we know that are part of the central region. But this value varies depending the structure and the data source.
Another method I have discussed or looked into are related to Figure 2. On the left is a cropped field of view of the sunspot and on the right is a histogram of this image in red and in yellow is the histogram of the background box from Figure 1. By using the histogram, I can work out the numerical gradient and pick the points with the largest shift. I also tried this method on the original image by taking slices along the sunspot, however, due to the non-uniform nature of a sunspot the results were not very good.
I was wondering if there were any suggestions to threshold this region that is not as ad hoc as my method?
Thanks, Nabil -- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. To post to this group, send email to scikit-image@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/CADwJ0z1Sthz7OW8uu2G2i%2Bm9Va... <https://groups.google.com/d/msgid/scikit-image/CADwJ0z1Sthz7OW8uu2G2i%2Bm9VaKPOEfnkuu%2BV70u-0Tjz75PMQ%40mail.gmail.com?utm_medium=email&utm_source=footer> . For more options, visit https://groups.google.com/d/optout. ------------------------------
-- You received this message because you are subscribed to the Google Groups "scikit-image" group. To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image+unsubscribe@googlegroups.com. To post to this group, send email to scikit-image@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/scikit-image/etPan.57427a2d.38cc4305.141c%... <https://groups.google.com/d/msgid/scikit-image/etPan.57427a2d.38cc4305.141c%40MacBook.local?utm_medium=email&utm_source=footer> . For more options, visit https://groups.google.com/d/optout.
participants (2)
-
Juan Nunez-Iglesias
-
Nabil Freij