blob detection and dust removal
hi folks, Got a problem removing dust and identifying blobs/crytals. Kindly see my code below from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np from skimage import io, feature, color, measure, draw, img_as_float, exposure from skimage.filters.rank import median from skimage.feature import blob_dog, blob_log, blob_doh from skimage.morphology import disk #raw image image_raw = img_as_float((io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif'))) (RawImage.tif attached) plt.imshow(image_raw) #converted to grayscale img_gray = color.rgb2gray(io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif')) plt.imshow(image_gray) #applied median filter to take out small dust particles. But the big dust particle on the top right corner still persists (see median1.png attached) img_filtered=median(img_gray,disk(10)) plt.imshow(img_filtered) #applied adapthist to make image more clearer (see adaptive.png) img_equalized=exposure.equalize_adapthist(img_filtered) plt.imshow(img_equalized) #trying to detect the crystals/blobs. I followed the example here http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob.... But this gave an error. matplotlib was not happy with the data type blobs_doh = blob_doh(img_equalized, max_sigma=30, threshold=.1) plt.imshow(blobs_doh) My problems are: 1. I could not get the dust particle out especially the really big one on the top right. How can I get it out? 2. I could not detect the crystals/blobs in the image using blob_doh Any ideas/suggestions is highly appreciated. Thank you!
Hello Raphael What error did you get ? Can you post the traceback or the output after blob detection ? Thanks Vighnesh On Saturday, April 30, 2016 at 2:02:51 AM UTC-4, Raphael wrote:
hi folks,
Got a problem removing dust and identifying blobs/crytals. Kindly see my code below
from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np from skimage import io, feature, color, measure, draw, img_as_float, exposure from skimage.filters.rank import median from skimage.feature import blob_dog, blob_log, blob_doh from skimage.morphology import disk
#raw image image_raw = img_as_float((io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif'))) (RawImage.tif attached) plt.imshow(image_raw)
#converted to grayscale
img_gray = color.rgb2gray(io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif')) plt.imshow(image_gray)
#applied median filter to take out small dust particles. But the big dust particle on the top right corner still persists (see median1.png attached) img_filtered=median(img_gray,disk(10)) plt.imshow(img_filtered)
#applied adapthist to make image more clearer (see adaptive.png)
img_equalized=exposure.equalize_adapthist(img_filtered) plt.imshow(img_equalized)
#trying to detect the crystals/blobs. I followed the example here http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob.... But this gave an error. matplotlib was not happy with the data type blobs_doh = blob_doh(img_equalized, max_sigma=30, threshold=.1) plt.imshow(blobs_doh)
My problems are:
1. I could not get the dust particle out especially the really big one on the top right. How can I get it out?
2. I could not detect the crystals/blobs in the image using blob_doh
Any ideas/suggestions is highly appreciated. Thank you!
hi Vighnesh, This is the error I got : --------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-73-121959b15938> in <module>() 1 blobs_doh = blob_doh(img_equalized, max_sigma=30, threshold=.1)----> 2 plt.imshow(blobs_doh) /usr/lib/python3/dist-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, hold, **kwargs) 2890 vmax=vmax, origin=origin, extent=extent, shape=shape, 2891 filternorm=filternorm, filterrad=filterrad,-> 2892 imlim=imlim, resample=resample, url=url, **kwargs) 2893 draw_if_interactive() 2894 finally: /usr/lib/python3/dist-packages/matplotlib/axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs) 7300 filterrad=filterrad, resample=resample, **kwargs) 7301 -> 7302 im.set_data(X) 7303 im.set_alpha(alpha) 7304 self._set_artist_props(im) /usr/lib/python3/dist-packages/matplotlib/image.py in set_data(self, A) 428 if (self._A.ndim not in (2, 3) or 429 (self._A.ndim == 3 and self._A.shape[-1] not in (3, 4))):--> 430 raise TypeError("Invalid dimensions for image data") 431 432 self._imcache = None TypeError: Invalid dimensions for image data I also printed blobs_doh and discovered it was an empty array..Don't know why it should be empty... Thank you On Sunday, 1 May 2016 01:48:13 UTC-7, Vighnesh Birodkar wrote:
Hello Raphael
What error did you get ? Can you post the traceback or the output after blob detection ?
Thanks Vighnesh
On Saturday, April 30, 2016 at 2:02:51 AM UTC-4, Raphael wrote:
hi folks,
Got a problem removing dust and identifying blobs/crytals. Kindly see my code below
from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np from skimage import io, feature, color, measure, draw, img_as_float, exposure from skimage.filters.rank import median from skimage.feature import blob_dog, blob_log, blob_doh from skimage.morphology import disk
#raw image image_raw = img_as_float((io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif'))) (RawImage.tif attached) plt.imshow(image_raw)
#converted to grayscale
img_gray = color.rgb2gray(io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif')) plt.imshow(image_gray)
#applied median filter to take out small dust particles. But the big dust particle on the top right corner still persists (see median1.png attached) img_filtered=median(img_gray,disk(10)) plt.imshow(img_filtered)
#applied adapthist to make image more clearer (see adaptive.png)
img_equalized=exposure.equalize_adapthist(img_filtered) plt.imshow(img_equalized)
#trying to detect the crystals/blobs. I followed the example here http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob.... But this gave an error. matplotlib was not happy with the data type blobs_doh = blob_doh(img_equalized, max_sigma=30, threshold=.1) plt.imshow(blobs_doh)
My problems are:
1. I could not get the dust particle out especially the really big one on the top right. How can I get it out?
2. I could not detect the crystals/blobs in the image using blob_doh
Any ideas/suggestions is highly appreciated. Thank you!
Hello Raphael The error here is because the output of blob_doh in a numpy array of blobs, it is not an image meant for display. If you notice the example the blobs are being drawn separately inside the for loop. If no blobs are being detected, you can adjust the threshold. Lowering the threshold will make the function detect more blobs. It is clarified futher in the documentation http://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.bl... I was able to detect one blob in your image with the default threshold value. See: https://gist.github.com/vighneshbirodkar/c16515126e648cf92f08d3319d3a023e Find the result attached. Thanks Vighnesh On Saturday, April 30, 2016 at 2:02:51 AM UTC-4, Raphael wrote:
hi folks,
Got a problem removing dust and identifying blobs/crytals. Kindly see my code below
from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np from skimage import io, feature, color, measure, draw, img_as_float, exposure from skimage.filters.rank import median from skimage.feature import blob_dog, blob_log, blob_doh from skimage.morphology import disk
#raw image image_raw = img_as_float((io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif'))) (RawImage.tif attached) plt.imshow(image_raw)
#converted to grayscale
img_gray = color.rgb2gray(io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif')) plt.imshow(image_gray)
#applied median filter to take out small dust particles. But the big dust particle on the top right corner still persists (see median1.png attached) img_filtered=median(img_gray,disk(10)) plt.imshow(img_filtered)
#applied adapthist to make image more clearer (see adaptive.png)
img_equalized=exposure.equalize_adapthist(img_filtered) plt.imshow(img_equalized)
#trying to detect the crystals/blobs. I followed the example here http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob.... But this gave an error. matplotlib was not happy with the data type blobs_doh = blob_doh(img_equalized, max_sigma=30, threshold=.1) plt.imshow(blobs_doh)
My problems are:
1. I could not get the dust particle out especially the really big one on the top right. How can I get it out?
2. I could not detect the crystals/blobs in the image using blob_doh
Any ideas/suggestions is highly appreciated. Thank you!
hi Vighnesh, Thanks a bunch!! I see my error now. Actually that blob you detected a dust particle. Which operation would you suggest to erase it? I tried morphological erosion but it doesn't take it away. Thanks Raphael On 1 May 2016 at 18:27, Vighnesh Birodkar <vighneshbirodkar@gmail.com> wrote:
Hello Raphael
The error here is because the output of blob_doh in a numpy array of blobs, it is not an image meant for display. If you notice the example the blobs are being drawn separately inside the for loop. If no blobs are being detected, you can adjust the threshold. Lowering the threshold will make the function detect more blobs. It is clarified futher in the documentation
http://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.bl...
I was able to detect one blob in your image with the default threshold value. See: https://gist.github.com/vighneshbirodkar/c16515126e648cf92f08d3319d3a023e
Find the result attached.
Thanks Vighnesh
On Saturday, April 30, 2016 at 2:02:51 AM UTC-4, Raphael wrote:
hi folks,
Got a problem removing dust and identifying blobs/crytals. Kindly see my code below
from __future__ import division, print_function import matplotlib.pyplot as plt import numpy as np from skimage import io, feature, color, measure, draw, img_as_float, exposure from skimage.filters.rank import median from skimage.feature import blob_dog, blob_log, blob_doh from skimage.morphology import disk
#raw image image_raw = img_as_float((io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif'))) (RawImage.tif attached) plt.imshow(image_raw)
#converted to grayscale
img_gray = color.rgb2gray(io.imread('/home/raphael/Documents/ScikitImage/Run 4-2_00061cropped.tif')) plt.imshow(image_gray)
#applied median filter to take out small dust particles. But the big dust particle on the top right corner still persists (see median1.png attached) img_filtered=median(img_gray,disk(10)) plt.imshow(img_filtered)
#applied adapthist to make image more clearer (see adaptive.png)
img_equalized=exposure.equalize_adapthist(img_filtered) plt.imshow(img_equalized)
#trying to detect the crystals/blobs. I followed the example here http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_blob.... But this gave an error. matplotlib was not happy with the data type blobs_doh = blob_doh(img_equalized, max_sigma=30, threshold=.1) plt.imshow(blobs_doh)
My problems are:
1. I could not get the dust particle out especially the really big one on the top right. How can I get it out?
2. I could not detect the crystals/blobs in the image using blob_doh
Any ideas/suggestions is highly appreciated. Thank you!
-- You received this message because you are subscribed to a topic in the Google Groups "scikit-image" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/scikit-image/VtkzL9ZCY6Q/unsubscribe. To unsubscribe from this group and all its topics, 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/0fd22d80-4549-470f-b61b-f48d9... <https://groups.google.com/d/msgid/scikit-image/0fd22d80-4549-470f-b61b-f48d9a8d66f5%40googlegroups.com?utm_medium=email&utm_source=footer> .
For more options, visit https://groups.google.com/d/optout.
participants (3)
-
Raphael
-
Raphael Okoye
-
Vighnesh Birodkar