how do I make a color (rgb) image look grayish?
古いコメントを表示
how do I make a color (rgb) image look grayish? not grayscale per se, but iteratively "washout" the color? I basically want to make a sequence of images that go from color to gray. any ideas?
採用された回答
その他の回答 (1 件)
Chris E.
2013 年 7 月 11 日
You can change the RGB from the desired color to gray by playing with the background set of an object. This is kind of code you may end up using:
% type guide, then make a text box and a button. Name the text box (the tag) "text" and the button (again the tag) "pb". Press save and then exit guide. Then add this code beneath to the button callback, similar to how it is shown here:
% --- Executes on button press in pb.
function pb_Callback(hObject, eventdata, handles)
r = 0;
g = 0;
b = 0;
for c = 1:100
r = c/100;
g = c/100;
b = c/100;
set(handles.text1, 'background',[r g b])
pause(0.1)
end
(gray is about r = 0.702, g = 0.702, b = 0.702.) Well this will do a fade or wipe type run through colors to show from black to white (goes through gray). This is at least a start or a help to get you started, however the question did not specify if it was in a GUI or a plot or where ever this was being done in or at. So I guess that is the best I can do for you. I hope it helps!
2 件のコメント
David
2013 年 7 月 11 日
Hello once more,
Well try this code out, just as is, goes through all colors then from black to white:
figure('Color',[0.8 0.8 0.8]);
for x = 1:10
for y = 1:10
for z = 1:10
r = x/10;
g = y/10;
b = z/10;
set(gca,'Color',[r g b]);
pause(0.1)
drawnow
end
end
end
for x = 1:10
c = x/10;
set(gca,'Color',[c c c]);
pause(0.1)
drawnow
end
Hope that helps!
カテゴリ
ヘルプ センター および File Exchange で Convert Image Type についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
