overlay two images in GUI
조회 수: 14 (최근 30일)
이전 댓글 표시
Hi,
I can't overlay two pictures in gui but I succeed to do this in figure. Take a look at my code when I do in Figure:
function link2axes(whole_matrix_sum,topography_trace)
figure;
ax1=axes;
raman=imagesc(whole_matrix_sum);
ax2=axes;
topography_image=imagesc(topography_trace);
linkaxes([ax1,ax2]);
ax2.Visible = 'off';
ax2.XTick = [];
ax2.YTick = [];
colormap(ax1,'jet'); %raman
colormap(ax2,'parula'); %topography
set(raman, 'AlphaData', double(whole_matrix_sum > 0));
set(topography_image, 'AlphaData', 0.6);
Here I have 2 images (2 matrices of 40X40 pixels). I succeed to do this when I create a figure but I cannot succeed it in Gui.
In Gui I try to write the similar thing but somehow it doesnt do overlay.
See attached the result of overlay of 2 pictures in Figure (as written in the attached code below).![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/627268/image.bmp)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/627268/image.bmp)
I have the handle which points on axes1 in the gui as handles.axes1.
I try to write code according the code which works on simple Figure as following:
axes(handles.axes1);
ax1=handles.axes1;
raman=imagesc(whole_matrix_sum);
raman.Parent;
ax2=raman.Parent;
topography_image=imagesc(topography_trace);
topography_image=imagesc(handles.topography_trace);
linkaxes([ax1,ax2]);
colormap(ax1,'jet'); %raman
colormap(ax2,'parula'); %topography
set(raman, 'AlphaData', double(whole_matrix_sum > 0));
Error using matlab.graphics.primitive.Image/set
Invalid or deleted object.
Here the matrix of topography I bring from another function that's why it's located in handles.
I attach 2 matrices as well.
As you can see I want overlay two pictures and to control transparency of the one of the pictures.
Where is my mistake?
Thank you very much.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!