MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Turning an image into grayscale and Deuteranomaly scale in Matlab (https://www.labfans.com/bbs/showthread.php?t=22097)

poster 2019-11-25 00:00

Turning an image into grayscale and Deuteranomaly scale in Matlab
 
<p>I want to turn an image from its original RGB scale to grayscale and deuteranomaly. However, every attempt I try gives me somewhat darker image that does not truly display grayscale.<a href="https://i.stack.imgur.com/7nvZs.png" rel="nofollow noreferrer">My attempt for grayscale</a>
here is what im running</p>

<pre><code>whe = imread('CoWheel.png');

whesi = size(whe);


red = [];
gree = [];
blue = [];

for i = 1:whesi(1)
for j = 1:whesi(2)
red(i,j) = whe(i,j,1);
gree(i,j) = whe(i,j,2);
blue(i,j) = whe(i,j,3);
end
end

gray = whe;
for i = 1:whesi(1)
for j = 1:whesi(2)

gray(i,j,1) = gray(i,j,1)*.2989;
gray(i,j,2) = gray(i,j,2)*.5870;
gray(i,j,3) = gray(i,j,3)*.1141;

end
</code></pre>

<p>And as for the deuteranomaly, I would have no clue into what to do to make that. Any help would be appreciated.</p>



[url=https://stackoverflow.com/questions/59009703/turning-an-image-into-grayscale-and-deuteranomaly-scale-in-matlab]More...[/url]


所有时间均为北京时间。现在的时间是 19:47

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.