MATLAB Answers

Creation of a black and white image

조회 수: 8(최근 30일)
Damien Dubois
Damien Dubois 2021년 6월 17일
댓글: Damien Dubois 2021년 6월 17일
Hello, I tried to create an image of 512 X 512 pixels filled with black and in its center a square of white pixels of width 100 pixels for the moment I use this code to display an image in black but I can not do it at all is it you have a solution ?
image=zeros(512,512,3); %initialize
image(:,1)=0.5; %(dark )
figure, imshow(image)

채택된 답변

Stephan
Stephan 2021년 6월 17일
image=zeros(512,512);
image(206:305,206:305)=255;
imshow(image)
  댓글 수: 1
Damien Dubois
Damien Dubois 2021년 6월 17일
Thank you very much.

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

추가 답변(0개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by