MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Convert Binary Image to Column Vector

  • To: mathgroup at
  • Subject: [mg83992] Re: Convert Binary Image to Column Vector
  • From: Jens-Peer Kuska <kuska at>
  • Date: Thu, 6 Dec 2007 02:46:27 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <fj65hr$fp1$>
  • Reply-to: kuska at


What is a binary image for you ? something like
    img=Graphics[Raster[{{0, 1}, {1, 0}}, {{0, 0}, {2, 2}}, {0, 1},
   ColorFunction -> GrayLevel], AspectRatio -> Automatic]
   or something like bm={{0, 1}, {1, 0}} ..

Since Flatten[bm] will make a vector out of a matrix as well
as Flatten[img[[1,1]]] it is not clear what ordering you perfer, i.e.
should in bm[[j,i]] the index i run first or the index j. This is
what you change with Transpose[].


Tara.Ann.Lorenz at wrote:
> Can a 30x30 binary image be converted directly into a column vector of
> 900 components in Mathematica? Or must the image first be put into
> matrix form?  I am using the command:
>  Flatten@Transpose@t1, 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 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.
> Any thoughts?
> Thanks.

  • Prev by Date: joint histogram of an three channels of an image
  • Next by Date: question with FindRoot
  • Previous by thread: Convert Binary Image to Column Vector
  • Next by thread: Re: Convert Binary Image to Column Vector