Effacer les filtres
Effacer les filtres

how i can convert a matrix in to a column vector and again i need to convert that column vector in to matrix form without disturbing the original pixels position

1 vue (au cours des 30 derniers jours)
i have an image in double format ,bnad 1 (:,:,1) , band2(:,:,2), 1. how can i convert image matrix in vector form 2. how i can reshape the converted vector in orignal matrix form, bithout disturbing the poxelx positions.

Réponses (1)

Jan
Jan le 11 Juil 2022
RGB = rand(640, 480, 3);
R = RGB(:, :, 1);
G = RGB(:, :, 2);
B = RGB(:, :, 3);
Rv = R(:); % Vectors for each channel
Gv = G(:);
Bv = B(:);
RGBv = [Rv; Gv; Bv]; % All as 1 vecor
Out = reshape(RGBv, 640, 480, 3); % Restore original immage:
isequal(RGB, Out) % Success:
ans = logical
1

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by