How to fix the Background Image scale in a overlay image

4 Ansichten (letzte 30 Tage)
Park
Park am 20 Apr. 2017
Kommentiert: Rik am 20 Apr. 2017
%# some image I = im2double( imread('peppers.png') );
%# I create here a random mask (gaussian centered in middle of image) [r,c,~] = size(I); [X Y] = meshgrid(1:r,1:c); Z = mvnpdf([X(:) Y(:)], [r c]./2, diag(15.*[r c])); Z = (Z-min(Z(:)))./range(Z(:)); Z = reshape(Z',[c r])';
%# show image and mask separately subplot(121), imshow(I) subplot(122), imshow(Z)
%# show overlayed images figure, imshow(I), hold on hImg = imshow(Z); set(hImg, 'AlphaData', 0.6);
The result image shows that the background rgb image is different from the original image Can you fix the original scale? I don't want the black area to have any effect.
  1 Kommentar
Rik
Rik am 20 Apr. 2017
Select your code and click on the {}Code button.
Have you tried the suggestion on StackOverflow of using h=imshow(I); set(h, 'AlphaData',Z)?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!