RGB image of size 500 x 500 pixels to a single array of size 250000.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ahmed khalid
el 6 de En. de 2021
Respondida: Image Analyst
el 7 de En. de 2021
Q. "Take a colored image of yourself consisting of RGB components of size 500x500 pixels. Read this image in Matlab and you will get the three channel components. Convert these three channels to a single array of size 250000"
What I am doing in this situation is, first i read the image than i split it into different R, G, B channel and then I m stuck in making the single array from those R, G, B channels.
My code is pasted below:
% Read an image (500 x 500 px) in MATLAB
rgbImage = imread('project.png');
% Extract the individial R, G and B Channel
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
z = zeros(size(rgbImage), class(rgbImage));
redImage = z; redImage(:,:,1) = redChannel;
greenImage = z; greenImage(:,:,2) = greenChannel;
blueImage = z; blueImage(:,:,3) = blueChannel;
subplot(2,2,1); image(rgbImage);
subplot(2,2,2); image(redImage);
subplot(2,2,3); image(greenImage);
subplot(2,2,4); image(blueImage);
% Convert three channels to a single array of size 250000
Need help !!
0 comentarios
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 6 de En. de 2021
A = randi(9, 5, 5)
reshape(A,25,1)
reshape(A,[],1)
A(:)
2 comentarios
Ver también
Categorías
Más información sobre PHY Components en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!