I need to add alpha plane mapping in an image and display individual alpha plane and also all added alpha plane result image. How to do it.?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have an image of 250x300 size. I need to add alpha plane mapping with 200 alpha planes in it and display individual alpha planes and also all added alpha plane result image. Please help how to do it.?
0 comentarios
Respuestas (2)
Image Analyst
el 4 de Feb. de 2016
I'm not clear what you want. Why don't you just create an image by adding all the "alpha planes" together? How is what you asked for any different than that? You can even have one such summed image be a transparency over another gray scale image.
0 comentarios
Walter Roberson
el 4 de Feb. de 2016
Example:
img = imread('YourImage.png');
imgg = rgb2gray(img);
counts = accumarray(imgg(:)+1, 1, [256 1]); %histogram
counts_nz = counts(2:end); %skip level 0
meaningful_levels = find(counts_nz >= 20); %find levels with at least 20 pixels
num_ml = length(meaningful_levels);
masks = cell(num_ml, 1);
for K = 1 : num_ml
this_level = meaningful_levels(K);
masks{K} = double(imgg == this_level);
fig = figure();
image(img, 'AlphaData', masks{K});
title(sprintf('Pixel value %d', this_level));
end
overall_mask = sum(cat(3, masks{:}),3);
image(img, 'AlphaData', overall_mask);
title('All levels together');
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!