Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Interesting problem with image alpha data
Date: Fri, 19 Jun 2009 08:44:02 +0000 (UTC)
Organization: Southampton General Hospital
Lines: 25
Message-ID: <h1fj4i$7ln$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245401042 7863 172.30.248.38 (19 Jun 2009 08:44:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 19 Jun 2009 08:44:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1769075
Xref: news.mathworks.com comp.soft-sys.matlab:548857


 I have come across an interesting problem with setting the alpha data for an image, which I can't quite get my head around.

 To explain, consider the following example:

 h1 = figure(1);
 h1a = axes('DataAspectRatio', [1 1 1], 'DrawMode', 'fast', 'Parent', h1);
 h1b = image('Parent', h1a);

 All works as expect, then:

 set(h1b, 'CData', imread('Peppers.png'));  % load a test image.

 This works just as would be expected.  So, I then try:

 set(h1b, 'AlphaData', 0.75);

 Which has the right effect.  However, this image isn't positioned very nicely within the axes, so I use:

 set(h1a, 'XLim', [1 512], 'YLim', [1 384], 'YDir', 'reverse');

 Which makes everything look nice.  But now if I set the alpha data to anything other than 1, the image just dissappears completely.  Can anyone tell me what is going wrong here?

 I'm using Matlab R2009a with version 6.3 of the Image Processing toolbox.

 Many thanks!