Whilst Amitha is correct, there is a general fix to VXL for this
problem, which I thought I had committed about a month ago. It is
committed now, and there is a copy of the patch in the attached email.
Ian.
Amitha Perera wrote:
> Szabolcs Berecz wrote about converting a greyscale image to
> vil_image_view<vil_rgb<vxl_byte> > and saving it:
>
>>The problem is, I can't save images converted with this function. With
>>png format I get the error message:
>>
>>ERROR! vil_png_file_format::make_output_image()
>>Pixel format should be byte, but is vil_rgb<vxl_byte> instead.
>>vil_new: Cannot new to type [png]
>
>
> The problem is that vil generally prefers to treat images as
> multi-planar, so that a 3-component RGB image is regarded as a 3-plane
> image with a planestep of 1 (i.e. interleaved planes). If you have
> your rgb image from your function and write
> vil_image_view<vxl_byte> rgb_planes = rgb;
> you'd get an image such that
> rgb_planes(i,j,0) == rgb(i,j).r &&
> rgb_planes(i,j,1) == rgb(i,j).g &&
> rgb_planes(i,j,2) == rgb(i,j).b
>
> (This won't actually copy data, so you don't have to worry about
> efficiency.) You should be able to save this planar image.
>
> Amitha.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Vxl-users mailing list
> Vxl-users@...
> https://lists.sourceforge.net/lists/listinfo/vxl-users
|