On Mon, 27 Jul 2009 19:08:16 Gary Capell wrote:
> I get this problem (with python2.6, PIL 1.1.6, numpy 1.3.0 )
>
> >>> from PIL import Image
> >>> import numpy
> >>> i = Image.open('chart_bl.tif')
> >>> a = numpy.asarray(i)
> >>> o.size, a.shape
> ((13228, 18710), (18710, 13228))
> >>> o.size, a.shape, a.dtype
> ((13228, 18710), (18710, 13228), dtype('bool'))
> >>> numpy.histogram(a)
> Segmentation faultI'm assuming your image is a binary (black and white only) image. In that case histogramming doesn't make much sense. If you want the numbers of ones and zeros, just do something like that: ones = a.sum() zeros = a.shape[0] * a.shape[1] - ones HTH, Guy -- Guy K. Kloss Institute of Information and Mathematical Sciences Te Kura Pūtaiao o Mōhiohio me Pāngarau Massey University, Albany (North Shore City, Auckland) 473 State Highway 17, Gate 1, Mailroom, Quad B Building voice: +64 9 414-0800 ext. 9585 fax: +64 9 441-8181 [email protected] http://www.massey.ac.nz/~gkloss _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig
