Joint Histogram
- To: mathgroup at smc.vnet.net
- Subject: [mg81121] Joint Histogram
- From: cimon <tamanna.arora at gmail.com>
- Date: Thu, 13 Sep 2007 06:25:30 -0400 (EDT)
Hello I am completely new to Mathematica and trying to work with images in it. I am trying to create a joint histogram out of an image taking its red and green channel. I get this error Table::iterb: Iterator (i,1,ydim), does not have appropriate bounds. Table::iterb: Iterator (i,1,ydim), does not have appropriate bounds. (see in code below) When I have just written the first five lines and i try to execute. i dont get this error. But when I have written the for loop and than i try to execute than I get this error. I am just not able to fix this out. can somebody plese guide me with this. ------------------------------------------------------------------------- penny = Import["c:\penny.ppm"]; Shallow[penny]; data = penny[[1, 1]]; ydim = Dimensions[data][[1]]; xdim = Dimensions[data][[2]]; Table::iterb: Iterator (i,1,ydim), does not have appropriate bounds. Table::iterb: Iterator (i,1,ydim), does not have appropriate bounds. (* Create a Joint table Go to each (i, j)th Location in red and green Channel Get Pixel value from (i, j)th location from each red and green channel Use that as an index into Joint Table and incerment the value at that index by 1 *) Joint = Table[0, {ti, 1, 256}, {tb, 1, 256}]; Dimensions[Joint]; For[fi = 0, fi =E2=89=A4 xdim, fi++ For[fj = 0, fj =E2=89=A4 ydim, fj++ Joint[redChannel[[fi, fj]], greenChannel[[fi, fj]]] += 1]]; Show[Graphics[Raster[Joint], AspectRatio -> 1, Axes -> True]] ---------------------------------------------------------------------------= ------------------------------------