用标题
编写一个函数function [newX] = myPhotoNegative(X)
其中X是包含0到1之间的双重值的三维矩阵
,其中
X(:,:,1)是红色等级
X(:,:,2)是绿色等级
X(:,:,3)是蓝色级别
此功能将使用其补码切换每个通道级别。
例如,
if X(10,20,1) had a value of 0.35, it will become 0.65
if X(10,20,2) had a value of 0.9, it will become 0.1
if X(10,20,3) had a value of 0.2, it will become 0.8
答案 0 :(得分:1)
只需对矩阵中的每个条目val
执行1-val
function newX = myPhotoNegative(X)
newX = 1-X;
end