New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blob Detection Example #986
Conversation
matplotlib can't load a jpg image because there is no there is no PIL on Python3. Should I resubmit this with a PNG image ? |
Being able to read JPG (via some external library) is pretty fundamental for an image-processing library like scikit-image. What is the recommended method for Python 3 for scikit-image users? |
|
||
blobs = blob_log(image_gray, max_sigma=30, num_sigma=10, threshold=.1) | ||
|
||
fig = plt.figure() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You basically repeat the same code three times.
Put it in a function and call that three times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you notice Line 85 is different than the other 2 cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then compute the three types of blobs first, multiply the one by sqrt(2)
, then proceed with a for loop over all three.
I am not sure what the recommended way is on Python3 but the freeimage plugin can do it |
Let's wait for the scikit-image devs to comment if JPG is OK for an example image. With a very quick search I couldn't find info on how to read JPG images in the scikit-image docs. |
FreeImage is installed on Travis, and should automatically be picked up. But even Matplotlib should be able to read JPEG, so not sure why this won't work on 3. |
Ah, it's actually Matplotlib raising the error. |
I guess Travis hates us for some reason 😟 |
Perhaps FreeImage should become the preferred default plugin: https://github.com/scikit-image/scikit-image/blob/master/skimage/io/manage_plugins.py#L47 Alternatively, disable the matplotlib plugin when PIL is unavailable (you can see how to do it in the freeimage plugin). |
|
||
blobs = blob_doh(image_gray, max_sigma=30, threshold=.01) | ||
|
||
fig = plt.figure() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer the following syntax:
f, ax = plt.subplots(1, 1)
We should probably default away from matplotlib for Python 3, at least until they decide Pillow is stable enough to incorporate or PIL comes back from the dead with a Python 3 compatible version... |
FreeImage cannot read a bytestream. Should I use a specific plugin in the failing test case ? |
(mpl dev) We have already switched to defaulting to pillow (atleast on the master branch matplotlib/matplotlib#2137 ) |
Why don't we just update our PIL plugin to also support pillow? |
@stefanv I thought there was a recent PR to do that? I think it was On Fri, Apr 25, 2014 at 5:20 PM, Stefan van der Walt <
|
Ah! If so, we probably only need to install pillow on the Python 3 |
Wouldn't it be better to install pillow for both Python 2 and Python 3 ? |
Sure, that's fine too. |
def hubble_deep_field(): | ||
"""Hubble eXtreme Deep Field | ||
|
||
This photograph contains the Hubble Telescopes farthest ever view of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hubble Space Telescope's
Looks good! Please fix the typos in the commit messages. Thereafter, I'll let @cdeil sign off on the changes. |
@stefanv FYI: Probably @vighneshbirodkar doesn't have permissions to re-start the travis-ci build. There's a feature request to let committers do this, but it's not available at the moment: travis-ci/travis-ci#887. |
Blobs are bright on dark or dark on bright regions in an image. In | ||
this example, blobs are detected using 3 algorithms. The image used | ||
in this case is the Hubble eXtreme Deep Field. Each bright dot in the | ||
image is a star or a galaxy, so we are literally counting stars. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true (I think most blobs are Galaxies, not stars), so I suggest to remove this statement:
so we are literally counting stars.
@vighneshbirodkar I've left some minor inline comments. Is it possible to link to API docs from the example text? |
Thanks for the detailed feedback, @cdeil! |
<http://hubblesite.org/newscenter/archive/releases/2012/37/image/a/>`__. | ||
|
||
The image was captured by NASA and `may be freely used in the | ||
public domain <http://www.nasa.gov/audience/formedia/features/MP_Photo_Guidelines.html>`_. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdeil The URL itself occupies 80 chars. IMHO we should not break the URL.
@vighneshbirodkar Thanks for taking all the little wording comments into account. I think there's one comment I wrote above you haven't taken into account (or rejected) yet:
Once that is addressed, 👍 to merge. I would prefer this slightly different way of writing the example: |
@cdeil |
Why not? |
@vighneshbirodkar OK, the current way you handle the blobs is perfectly fine! @stefanv In my opinion this is ready to merge. |
@stefanv Merge this now? Can this still go in the upcoming release? |
Thanks, @vighneshbirodkar & @cdeil! |
@vighneshbirodkar I don't know if you saw it ... this data example and blob detection is featured in this article on the IPython notebook in Nature (click on the interactive demo link): Pretty cool! |
👍 ! |
Thanks. I wasn't aware .
|
@cdeil
The Hubble Deep Field image is added here.
My only concern is the example runs 3 algorithms, and is unresponsive for 6s before all 3 images pop up.