The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Interesting problem with image alpha data
Replies: 5   Last Post: Jul 12, 2013 5:02 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1
Registered: 6/19/09
Interesting problem with image alpha data
Posted: Jun 19, 2009 4:44 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.