Assign 3-by-1 matrix to image 3D matrix

2 次查看(过去 30 天)
Hello,
I get color values from loop and impixel function.
Color values is 1x3 matrix.
For my calculate must be color dimension like 3x1, therefoe transponing. Result is 3x1 matrix (LMS).
My question is:
how assign 3x1 (LMS) matrix to new matrix (A_LMS) which will be built (and dimension increase) simultaneously. New matrix (A_LMS) is the same size of original image (A)?
for Z = 1 : Za
for Y = 1 : Ya
for X = 1 : Xa
color = impixel(A, X, Y);
LMS = mapM*(color.');
A_LMS(, , Z) = LMS.';
end
end
end

采纳的回答

Grega Mocnik
Grega Mocnik 2019-9-17
I solve this issue:
for Z = 1 : Za
for Y = 1 : Ya
for X = 1 : Xa
color = impixel(A, X, Y);
LMS = mapM*(color.');
[Xlms, Ylms] = size(LMS);
for Y_LMS = 1 : Ylms
for X_LMS = 1 : Xlms
A_LMS(X, Y, Z) = LMS(X_LMS, Y_LMS);
end
end
end
end
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by