필터 지우기
필터 지우기

Segmentation fault when printing images with transparency and -nodisplay option

조회 수: 2 (최근 30일)
I'm running MATLAB 2012a on Linux's command line with -nodisplay option. When I run my code I get a segmentation fault. The following piece of code reproduce my error. The error is produced when the plot has transparencies. If I comment out this line put alpha(h2,0.5);, it works fine.
filename ='mypng.png';
Image1 = imread('peppers.png');
[row,col,~]=size(Image1);
Image2 = ones(row,col);
f=figure(1);set(f,'Visible','off');
h1=imagesc(Image1);
hold on
h2=imagesc(Image2);
alpha(h2,0.5);
axis off;
print(f,'-dpng',filename);
The result is: Segmentation fault (core dumped).
Any idea how to fix this problem?

채택된 답변

Marta Salas
Marta Salas 2014년 6월 18일
I'm answering my own question, just in case someone else run into this problem (although it's improbable). The purpose of running matlab in terminal with -nodisplay option is because I work on a headless server.
The use of -nodesktop instead of -nodisplay does the trick.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by