用标题编写一个函数
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
只需对矩阵中的每个条目val
执行1-val?
function newX = myPhotoNegative(X)
newX = 1-X;
end