필터 지우기
필터 지우기

how can I generate a grayscale image with the triangle having an intensity value of 22 and the background having an intensity value of 229.

조회 수: 1 (최근 30일)

채택된 답변

Voss
Voss 2021년 12월 10일
A = imread('image.png'); % image.png is the image posted, which is a logical array
A_out = zeros(size(A),'uint8'); % greyscale output image -> 2-D uint8
A_out(~A) = 229; % background = 229
A_out(A) = 22; % foreground = 22
% A_out is the requested output image
imwrite(A_out,'image_out.png'); % write it to file if you like
  댓글 수: 6
Voss
Voss 2021년 12월 11일
Great, no problem. Please mark my answer as accepted, if you don't mind.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modify Image Colors에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by