1

I have an image, loaded from a file thus:

img = misc.imread('mypic.jpg')

it is a 3 dimensional, RGB numpy.ndarray. I wish to turn it into a greyscale ndarray (1-D).

eran
  • 14,496
  • 34
  • 98
  • 144

1 Answers1

1

I don't know if I understood your question, but I think this should do what you want:

img = misc.imread('mypic.jpg', flatten=True)

See the documentation: http://docs.scipy.org/doc/scipy/reference/generated/scipy.misc.imread.html

Jblasco
  • 3,827
  • 22
  • 25
  • That's exactly what I asked. Is there a way to do this on the NxMx3 RGB array? without reading the file from disk again? – eran Oct 16 '13 at 07:07
  • In that case I would go for the solution provided in the link by @Ophion. – Jblasco Oct 16 '13 at 15:44