>If you do Pkg.update(), then
>
>    reinterpret(Uint8, separate(img))
>
>should work. If you think this needs to be documented, please add it to the 

It does not currently work for me:

    julia> img=imread("imgs/simple.png")
    RGB Image with:
      data: 320x200 Array{RGB{UfixedBase{Uint8,8}},2}
      properties:
        IMcs: sRGB
        spatialorder:  x y
        pixelspacing:  1 1

    julia> i=reinterpret(Uint8,separate(img))
    ERROR: auto_unbox: unable to determine argument type
     in reinterpret at number.jl:46


Changing the order of both operations works:

       i=separate(reinterpret(Uint8,img))

I will look at the README again when I have more time and better understanding
of what is happening.

>One of the advantages of representing as an RGB type is that, for most 
>algorithms, you no longer need to worry about this: you can process all 3 
>color channels at once, because operations are defined for RGB that allow you 
>to add, multiply, etc. But use reinterpret or separate if you still want/need 
>to do this.

I understand what you mean and in the new code I will try to take
advantage of this. 

Do you know if there is any performance penalty? I have tried to measure
it but it is hard since the time seems to be dominated by garbage collection.

>The most general and efficient way is to use Julia's multiple dispatch: write 
>different versions of your algorithm for

Yes but sometimes I would like to write quickly a function that works
for all images, without worrying about different image representation,
and specialize for speed later. 

Well, I guess this is the price to pay for offering different
choices. It hits me now because I have already some code written and
need to adapt it. In the future, I will just stick to one type of image
representation.

Yours,

Jan

-- 
-------------------------------------------------------------------------
Jan Kybic <[email protected]>               tel. +420 2 2435 5721 or 5877
http://cmp.felk.cvut.cz/~kybic                              



Reply via email to