how to change the background in imshow from black to white
25 次查看(过去 30 天)
显示 更早的评论
get(0,'Factory');
set(0,'defaultfigurecolor',[1 1 1]);
whitebg(figure);
set(gcf,'color','white');
set(gca,'color','none');
figure; clf;
imshow(pairOfImages);
The result is this
I want a result that shows the pyramid with a white background.
Thanks
1 个评论
回答(2 个)
Morteza
2015-8-19
编辑:Morteza
2015-8-19
try this save your picture like Untitled.png on your desktop and then call it from MATLAB like below:
clc,clear all
A = imread('C:\Users\MORTEZA\Desktop\Untitled0.png');
figure(1)
image(A)
[L,W,D] = size(A);
for i = 1:L
for j = 1:W
for k = 1:D
if A(i,j,k) == 0
A(i,j,k) = 255;
end
end
end
end
figure(2)
image(A)
3 个评论
Keerthi D
2020-6-29
编辑:Image Analyst
2020-8-22
Sir I tried your code above, but I didn't get.
A=imread('C:\Users\Keerthi Dev\Desktop\matlabwork\seg1.png');
figure(1)
image(A)
[L,W,D] = size(A);
for i = 1:L
for j = 1:W
for k = 1:D
if A(i,j,k) == 0
A(i,j,k) = 255;
end
end
end
end
figure(2)
image(A)
result is:
Sir, please help me to solve my problem
Image Analyst
2020-8-22
Sure, but please post it in a new post, not tacked onto a 5 years old post from someone else.
hf fh
2018-9-19
I have a grayscale image, Please help me I have a picture and I want to make the background color white I used the previous method but did not good out with me
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!