From: Sophie on
So it's really not possible to do it directly when creating and using imagesc? We have to save it in png to do that?:(


> Save the image to png using imwrite. You can then specify an alpha matte, as described here (parameter 'Alpha'):
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/imwrite.html#f25-742371
From: Oliver Woodford on
"Sophie" wrote:
> So it's really not possible to do it directly when creating and using imagesc? We have to save it in png to do that?:(
>
>
> > Save the image to png using imwrite. You can then specify an alpha matte, as described here (parameter 'Alpha'):
> > http://www.mathworks.com/access/helpdesk/help/techdoc/ref/imwrite.html#f25-742371

It is perfectly possible to make areas of an image transparent in a figure, but that is not what the OP was asking.

For your purpose I suggest you read the following, and pay particular attention to the alphadata and alphadatamapping properties:
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/image_props.html

Oliver
From: Sophie on
Yes sorry I realized afterwards that it was not exactly the question. I think I managed to do what I wanted:
figure,
I = reshape(images(:,1,3),[35,57]);
A = zeros(35,57);
A(:) = 0.5;
A(I>0.01) = 1;
h1=imagesc(I);caxis([-0.02 0.02]);
hold on
set(h1,'alphadata',A);

Thanks!