How change somme values on a matrix?

1 回表示 (過去 30 日間)
Biza Ferreira
Biza Ferreira 2015 年 6 月 27 日
編集済み: Salaheddin Hosseinzadeh 2015 年 6 月 27 日
for example I have a "A" matrix , i want change somme pixel values inside him, like this example:
if true
% code
if A<=20
A(value)=0;
else
A(value)=255;
end
How can I do this?!

採用された回答

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2015 年 6 月 27 日
編集済み: Salaheddin Hosseinzadeh 2015 年 6 月 27 日
Hi Biza,
It sounds like you want to do thresholding.
A = A>20; % this makes A a logical matrix of 0 and 1, 1 is when A < 20
A = A.*255;
Anyway, this will do the job for you ;)

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by