<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7651.59">
<TITLE>Numpy unexpected result: subtraction of cell values</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>
<P><FONT SIZE=2 FACE="Arial">I'm sure this is easy, but I am having a difficult time finding the right search terms to find it on the Internet. Any help much appreciated.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">3 dimensional array(x,y,rgb) which is a PIL image into a numpy array using 'asarray' function.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I want to subtract the Red Value in an array cell from a neighboring Red Value cell.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">>>> pictArray[39][4] #pixel at 39 4</FONT>
<BR><FONT SIZE=2 FACE="Arial">array([150, 140, 120], dtype=unint8)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">>>> pictArray[39][5] #pixel at 39 5</FONT>
<BR><FONT SIZE=2 FACE="Arial">array([160, 150, 120], dtype=unint8)</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">>>> pictArray[39][4][0] #red pixel</FONT>
<BR><FONT SIZE=2 FACE="Arial">150</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">>>> pictArray[39][5[0] #neighboring red pixel</FONT>
<BR><FONT SIZE=2 FACE="Arial">160</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">>>> pictArray[39][4] - pictArray[39][5] )</FONT>
<BR><FONT SIZE=2 FACE="Arial">246 # <--------------- ??? vs -10</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">How do I get the number -10? Does this have to do with the dtype?</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Thanks in advance, </FONT>
</P>
<P><B><FONT FACE="Times New Roman">James Carnell</FONT></B>
</P>
</BODY>
</HTML>