[Numpy-discussion] Syntax trouble in translating matlab code to numpy
Thu Apr 12 14:09:12 CDT 2007
Oliver Siemoneit wrote:
> # Transform to LMS space
> LMS = numpy.zeros_like(RGB)
> for i in range(RGB.shape):
> for j in range(RGB.shape):
> rgb = RGB[i,j,:2]
> LMS[i,j,:2] = numpy.dot(rgb2lms, rgb)
> This code fails in the last line with the error message "ValueError:
> matrices are not aligned". But how to align them?
You want :3, not :2.
By the way, I have some code that applies a more rigorous model for
colorblindness. The class LinearCorrespondingPairs in this file:
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion