Turned image into matrix

I have 3 pictures of owl in the attachment.
I wish to turn these picture into a matrix value in the below picture.
I guess its simple, but i dont know how, can someone help me with this code?? ty

4 件のコメント

Manas
Manas 2023 年 6 月 2 日
Hi Putra,
You can use the following code to load files into matlab. Keep the image files and and .m file in same directory.
A = imread('owl.0.jpg');
B = imread('owl.1.jpg');
C = imread('owl.2.jpg');
You can refer to this documentation for more info Read image from graphics file
pizzaa
pizzaa 2023 年 6 月 2 日
編集済み: pizzaa 2023 年 6 月 2 日
I m sorry sir, i mean make these owl pictures into, 340x512x3 . the same format as the "I" value in picture
pizzaa
pizzaa 2023 年 6 月 2 日
I tried imread and save it in one .mat file, but i want all 3 images have the same name.
just like this 3 picture format, which in the same name "I"
Manas
Manas 2023 年 6 月 2 日
Hi Putra,
In the "I' file, 65536 x 3, here '3' is for the RGB values, it doesn't signify that is has 3 different images stored in it. If you really want all the .jpg files in same matrix, then you can use the following code
A = imread('owl.0.jpg');
B = imread('owl.1.jpg');
C = imread('owl.2.jpg');
I = [A B C];

サインインしてコメントする。

回答 (1 件)

Ayush
Ayush 2023 年 6 月 2 日

0 投票

Hi Putra, Actually here we can use imread function:
img1=imread('owl.0.jpg');
img2=imread('owl.1.jpg');
img3=imread('owl.2.jpg');
Now as you want to concatenate the matrix , we can do the same as follows:
IMG1 = [img1 img2 img3] %340 x 1536 x 3
%or
IMG=[img1;img2;img3] % 1020 x 512 x 3
Here you can access individual images as follows:
img1=IMG(1);
img2=IMT(2);
img3=IMG(3);
For more understanding , you can refer here :Concatenating Matrices

質問済み:

2023 年 6 月 2 日

回答済み:

2023 年 6 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by