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.
    3 次查看(过去 30 天)
  
       显示 更早的评论
    

采纳的回答
  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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


