Re: Convert Binary Image to Column Vector
- To: mathgroup at smc.vnet.net
- Subject: [mg83977] Re: Convert Binary Image to Column Vector
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Thu, 6 Dec 2007 02:38:31 -0500 (EST)
- References: <fj65hr$fp1$1@smc.vnet.net>
Tara.Ann.Lorenz at gmail.com wrote: > Can a 30x30 binary image be converted directly into a column vector of > 900 components in Mathematica? It depends on what you mean by "image", > Or must the image first be put into > matrix form? and what you mean by "matrix". > I am using the command: > Flatten@Transpose@t1, This command works if t1 is a two-dimensional array, i.e. a nested list that looks like this when output is set to StandardForm: {{1,2},{3,4}} > where t1 is my binary image, and it seems to > give me a vector but I'm not sure if it's the one that I desire. > > If I first convert my image into matrix form How did you do this conversion? If the image is inside Graphics[Raster[...]], then you need to extract the contents of Raster[...]. > and define my matrix as > "m" and then use this command, > Flatten@Transpose@m, then I get an output of "Transpose[...]" and my > 30 x 30 matrix is explicitly written within the Transpose brackets. > This does not provide me a column vector with 900 components, which is > what I am looking for. In Mathematica there are no column or row vectors, only vectors and matrices (one might call n*1 matrices column vectors and 1*n matrices row vectors). Have you read the post I suggested in my answer to you last question? Here's the link again: http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/24fa2f19317734fa/69770c22c257ca29#69770c22c257ca29 If you use TraditionalForm output, try switching to StandardForm for a while to better understand how matrices/vectors are represented. Szabolcs