Dear All, as i'm new to this list let me first introduce
> myself before posting a question.
> I'm working in the field of image processing and computer
> vision for a long time now and i am a long time matlab
> user. Up to now i didn't like any of the matlab clones but
> it seems that numarray+matplotlib might be a winner here.
I've worked some with octave in the past and found it unsatisfying
(though a very impressive one man feat!), in part because I wasn't
happy with gnuplot, which it used for graphics at the time (and
perhaps still does), and in part because it really aimed at being a
matlab clone but very few of my m-files ran w/o alteration.
matplotlib tries to solve the first problem by producing better
graphics than matlab and the second by not trying to be a drop in
replacement for matlab.
I'm curious about your experiences, what you tried, and what you found
lacking.
> I started using numarray+matplotlib by coding the Gaussian
> derivative convolutions. Calculating a derivative (by
> convolving with the derivative of the Gaussian function)
> will lead to an image(array) with both positive and negative
> values. Although imshow should deal with that (as far as i
> understand the code: beware i am a Python beginner) the
> display turns black for all derivatives (except for the
> 'zero order' derivative of course).
> What is going on? Is it me (probably) or is it imshow?
In matplotlib-0.54.2, the images must be normalized to the unit
interval before color mapping or plotting. For example, in
examples/image_demo2.py, notice that I do
A *= 1.0/max(A)
Your images are black, I think, because you haven't normalized them.
I've done a lot of work on matplotlib images since 0.54.2, with new
fixes and features. Normalization is handled by default in the 0.60
release candidate. When I run your (very nice) example with my
development version of matplotlib, it produces this image for figure 2
( I added "show" at the end of your script, but it was otherwise
unaltered)
http://nitace.bsd.uchicago.edu:8080/files/share/fig2.png
which looks right to me. I'm always interested in nice screenshots
for the web site, so please consider donating this example!
I've uploaded the 0.60d release candidate to
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.60d.tar.gz
Can you compile matplotlib yourself or are you using a binary
distribution? If you can try the development version linked above,
that would solve two problems: you'll get enhanced image support and
I'll get a tester for my image changes. If you do so, see the updated
help for the image related commands: imshow, figimage, clim, jet, gray
and the new matplotlibrc parameters image.*
In the figure 2 image from your script, I notice that there the titles
overlap the images above. Here is how you can control this (requires
matplotlib 0.60d)
# pass in these keywor args to title. The y location is the y
# text coordinate in axes coords (0,0 is lower left, 1,1 is
# upper right). You can use **somedict in place of keyword
# args in python
offsets = {'y':1.0, 'fontsize':10}
_gDplot(1,0,0)
title(r'G', **offsets)
_gDplot(5,1,0)
title(r'G\_x', **offsets)
_gDplot(6,0,1)
title(r'G\_y', **offsets)
_gDplot(9,2,0)
title(r'G\_\{xx\}', **offsets)
_gDplot(10,1,1)
title(r'G\_\{xy\}', **offsets)
_gDplot(11,0,2)
title(r'G\_\{yy\}', **offsets)
_gDplot(13,3,0)
title(r'G\_\{xxx\}', **offsets)
_gDplot(14,2,1)
title(r'G\_\{xxy\}', **offsets)
_gDplot(15,1,2)
title(r'G\_\{xyy\}', **offsets)
_gDplot(16,0,3)
title(r'G\_\{yyy\}', **offsets)
Cheers,
JDH