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

1 view (last 30 days)
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

Accepted Answer

Grega Mocnik
Grega Mocnik on 17 Sep 2019
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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!