Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Image to x,y,z' topicStudent Support Forum > General > "Image to x,y,z"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
10/18/12 5:31pm

There are perhaps faster more complicated ways of doing this, but this might be easier to understand.

Suppose your imagedata is in the variable pixels.

In[1]:= pixels={{1,2,3},{2,3,5}};
yxp=Table[{y,x,pixels[[y,x]]},{y,1,2},{x,1,3}]

Out[1]= {{{1,1,1},{1,2,2},{1,3,3}},{{2,1,2},{2,2,3},{2,3,5}}}

The x and y are in that order because it stores the data row by row. If you experiment you can probably figure out how to reverse the order if need be. You can determine the bounds on x and y by looking at Dimensions[pixels]

URL: ,

Subject (listing for 'Image to x,y,z')
Author Date Posted
Image to x,y,z Jay 10/18/12 2:02pm
Re: Image to x,y,z Bill Simpson 10/18/12 5:31pm
< Previous CommentHelp | Reply To Comment | Reply To Topic