| Author |
Comment/Response |
cimon
|
09/12/07 6:45pm
Hello
I am new to Mathematica
and trying to work with images in it.
I am trying to create a 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.
-------------------------------------------------------------------------
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 ≤ xdim, fi++
For[fj = 0, fj ≤ ydim, fj++
Joint[redChannel[[fi, fj]], greenChannel[[fi, fj]]] += 1]];
Show[Graphics[Raster[Joint], AspectRatio -> 1, Axes -> True]]
---------------------------------------------------------------------------------------------------------------
And another confusion I have is while indexinginto an array when we use a[[i,j]]and when we use normal A[i,j](ie single brackets)
URL: , |
|