Overlaying a semi-transparent color over an image

8 ビュー (過去 30 日間)
saad khalid
saad khalid 2015 年 8 月 5 日
回答済み: Image Analyst 2015 年 8 月 6 日
I thought that this would be fairly simple, and maybe it is, but unfortunately reading Steve's blog post describing something similar to this didn't help. I have a a png image with an alpha channel. I would like to concatenate this image with an overlay of a a color on top of it. The overlay would obviously have the same dimensions. I still want to be able to see the background image, I just want a semi-transparent color overlayed on top of it. I think that it's important to concatenate the image with the overlay, because I will be showing several images that fit together on the same figure, so I will be using each of the original images alphaData, so that the pictures don't cover each other up.
Sorry if this actually is very straight forward, I just haven't gotten it to work for me.

回答 (3 件)

Jeff E
Jeff E 2015 年 8 月 5 日

Walter Roberson
Walter Roberson 2015 年 8 月 6 日
You cannot do this by concatenating together images. For MATLAB graphics, each image must have either 1 or 3 colorplanes. Each image may have an associated Alpha channel, which can be a scalar (in which case it applies to all locations) or the Alpha may be an array the same size as the image, indicating transparency on a pixel-by-pixel basis.
You can have multiple images in an axes. The last one added will be "on top" in 2D scenes... mostly... not always.

Image Analyst
Image Analyst 2015 年 8 月 6 日
Why don't you just create a new image that is the average or weighted average of all the RGB images you want to show in that axes? How many overlays/graphics channels will be on top of the group of images? Maybe you could do the same with those to create just one overlay channel.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by