samedi 21 février 2015

Generate an HSV image from an `M` by `N` by 3 array in Julia

I have an M by N by 3 array of floating-point reals which I would like to interpret as the HSV channels of an image. I would like to generate and export the image.


According to the function documentation,




colorim(A, [colorspace])


Creates a 2d color image from an AbstractArray, auto-detecting which of the first or last dimension encodes the color and choosing between "horizontal-" and "vertical-major" accordingly. colorspace defaults to "RGB" but could also be e.g. "Lab" or "HSV".



I first tested the RGB case:



using Images
imwrite(colorim(rand(Float64, 200, 200, 3), "RGB"), "Image.PNG")


which produces the following:


enter image description here


However, when I replace "RGB" with "HSV" as per the documentation, I get an error message.


What is the correct syntax to interpret and export an array as HSV data?


Aucun commentaire:

Enregistrer un commentaire