| Date: Mon, 21 Jan 2008 09:39:21 -0500 | From: "theodore test" <[EMAIL PROTECTED]> | | Hello all, | | I'm scratching my head over how to make this image color space | conversion from "RGB" to "HSV" quicker. It requires input from all | three bands of a given pixel at each pixel, and thus can't be | easily flattened. I've already implemented psyco and removed the | extra step of calling colorsys's rgb_to_hsv function by adapting | the code into my primary for loop. | | Right now it takes around 9 seconds for a single 1600x1200 RGB image, a | conversion that I've seen implemented more or less instantly in, say, | ImageJ. What can I do to make this conversion more efficient?
I would love to see a decent implementation of that! We have versions quite similar to yours, instead. We've had a to-do list item to reimplement rgb_to_hsv (and its converse hsv_to_rgb) in C using weave, but haven't ever gotten around to it. I believe the best solution would be for PIL to be modified to accept an image of type HSV; it already accepts four others, including the non-obvious CMYK: m.mode => string Image mode. This is a string specifying the pixel format used by the image. Typical values are "1", "L", "RGB", or "CMYK." Adding CSV to this list would seem quite reasonable, and would allow simple conversion between the various color spaces. But I don't know anything about the internals of the PIL code, to know whether that would indeed make sense. Jim _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion