Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Grega Mocnik
Grega Mocnik le 17 Sep 2019
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

Réponse acceptée

Grega Mocnik
Grega Mocnik le 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

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by