Display transparent image on axes (MATLAB) -
so have transparent image (http://imgur.com/fyqslax) want display on axes in matlab transperancy. this, used code below, works other transparent png images have:
[a, map, alpha] = imread('fyqslax.png'); h = imshow(a, map) set(h, 'alphadata', alpha);
this code however, not seem work image above. im guessing because has image being grayscale , having bitdepth of 1, resulting in map , alpha having nothing in (whereas other png transparent images have, have in map , alpha). if use this:
a = imread('fyqslax.png'); h = imshow(a)
a black background appears image should transparent.
how display http://imgur.com/fyqslax transperancy on axes?
edit: horchler's method worked; thanks!!
if run imfinfo('fyqslax.png')
, you'll see 'transparency'
specified 'simple'
, 'simpletransparencydata'
set 0
(false
). can't find documentation on this, think may indicate alpha channel has been compressed image data because the image binary , grayscale. image binary mask, either transparent or not. can display image this:
a = imread('fyqslax.png'); h = imshow(a); set(h, 'alphadata', a);
if try return colormap and/or alpha channel imread
using output arguments, you'll see both empty.
Comments
Post a Comment