<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.28.3">
</HEAD>
<BODY>
Hi MinRK,<BR>
I tried your notebook, but when I execute the cell "imshow(img)" no image is shown in the notebook.<BR>
All the previous cells execute without error that I can tell.<BR>
<BR>
D<BR>
<BR>
On Wed, 2012-07-18 at 16:49 -0500, MinRK wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
On Wed, Jul 18, 2012 at 4:12 PM, Thomas Kluyver <<A HREF="mailto:takowl@gmail.com">takowl@gmail.com</A>> wrote:<BR>
<BLOCKQUOTE>
Hi Darren,
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<BR>
On 18 July 2012 22:01, Darren Govoni <<A HREF="mailto:darren@ontrenet.com">darren@ontrenet.com</A>> wrote:<BR>
> 1) Is there a thorough tutorial on notebook? From hello world to the UI<BR>
> features?<BR>
<BR>
<BR>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
There's a folder of example notebooks, including an introduction one.<BR>
They may have come with your installation, depending on where you got<BR>
it from, or you can get them here:<BR>
<A HREF="https://github.com/ipython/ipython/tree/master/docs/examples/notebooks">https://github.com/ipython/ipython/tree/master/docs/examples/notebooks</A>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<BR>
> 2) I want to do some image processing with it. Is there an example (or is it possible) > to interact with image data? e.g. run some ipython code, return/display the image result?<BR>
<BR>
<BR>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
It's certainly possible, although I don't know if there's an example<BR>
yet. For simple cases, matplotlib has imread() and imshow() functions.<BR>
Working with PIL might need a little integration, but hopefully just a<BR>
few extra lines.
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
Here is a notebook I made while trying to follow along with one of Fernando's Py4Science tutorials, which covered working with image data:
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<A HREF="https://gist.github.com/3139142">https://gist.github.com/3139142</A>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
It includes the code for automatically displaying PIL objects as images in the notebook, which I added later:
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
from io import BytesIO
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
def display_image(img, format='PNG'):
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
fp = BytesIO()
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
img.save(fp, format=format)
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
return fp.getvalue()
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
ip = get_ipython()
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
png_formatter = ip.display_formatter.formatters['image/png']
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
png_formatter.for_type_by_name('Image', 'Image', display_image)
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
which we might want to have on by default.
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
-MinRK
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
<BR>
Best wishes,<BR>
Thomas
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BLOCKQUOTE>
_______________________________________________<BR>
IPython-User mailing list<BR>
<A HREF="mailto:IPython-User@scipy.org">IPython-User@scipy.org</A><BR>
<A HREF="http://mail.scipy.org/mailman/listinfo/ipython-user">http://mail.scipy.org/mailman/listinfo/ipython-user</A><BR>
<BR>
</BLOCKQUOTE>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<PRE>
_______________________________________________
IPython-User mailing list
<A HREF="mailto:IPython-User@scipy.org">IPython-User@scipy.org</A>
<A HREF="http://mail.scipy.org/mailman/listinfo/ipython-user">http://mail.scipy.org/mailman/listinfo/ipython-user</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>