필터 지우기
필터 지우기

how to make image transparent

조회 수: 21 (최근 30일)
kmla
kmla 2018년 9월 11일
댓글: kmla 2018년 9월 18일
I have an image like this
I want to make it transparent with a degree of transparency variable.

답변 (1개)

Walter Roberson
Walter Roberson 2018년 9월 11일
For example,
im = image(YourRGBImage);
for K = 0 : 20
set(im, 'AlphaData', K/20);
drawnow();
end
The form I used is for the case where you have the same transparency for the entire image. If you want to vary the transparency at different locations, then instead of setting the AlphaData to be a scalar, set it to be a double array with the same number of rows and columns as the image. Alpha of 0 is fully transparent and value of 1 is fully solid. (Do not use boolean for alpha data: MATLAB will complain about that.)
  댓글 수: 1
kmla
kmla 2018년 9월 18일
thank you for your answer but I'm working on a grey image. I use this code
for c=1:0.1:3.9
for i =1:size(I1,1)
for j=1:size(I1,2)
S(i,j)=I1(i,j)*c;
end
end
figure, imshow(S)%
end

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by