|
In article <fq7kgp$j2a$1@fred.mathworks.com>,
Matthew Whitaker <mattlwhitaker@REMOVEgmail.com> wrote:
>"Phil Au" <philipawt@gmail.com> wrote in message <fq7if2
>$nmt$1@fred.mathworks.com>...
>> Does anyone know that a way to turn a logical image or
>> uint8 image, from black background to white background
>from
>> white line to black line in a simple step??
>imshow(u8)
>imshow(intmax(class(u8))-u8) %where u8 is a uint8 image
Unfortunately that last line does not generalize to int8
as might be hinted by the use of intmax(class(u8)) instead than
the hardcoding of the constant 255.
This generalizes a little better, provided T is one of the int classes.
reshape(typecast(bitxor(typecast(T(:),'uint8'),uint8(255)),class(T)),size(T))
--
"There are some ideas so wrong that only a very intelligent person
could believe in them." -- George Orwell
|