How to convert image into matrix

Dear readers, i am new to matlab and want to learn how to convert or represent a picture in bmp or jpeg format in matrix form so that manipulations can be carried out on it. your suggestions will be worth for me..
suyash bhardwaj

回答 (5 件)

Andreas Goser
Andreas Goser 2012 年 4 月 27 日

3 投票

If you import a picture, it is actually a matrix, so I am not sure what do are looking for. Try:
imdata = imread('ngc6543a.jpg');

6 件のコメント

Nicholas
Nicholas 2013 年 5 月 6 日
If am not wrong. Suyas is asking for how to convert an image into data e.g. if you want to use it in pattern recognition. Convert say black squares (pixel) to 1s and white to 0s. I am in the same situation and I need help too.
Image Analyst
Image Analyst 2013 年 5 月 6 日
I have no idea what you mean. An image is a numerical array of numbers that represent something, such as illuminance. If that array is not data to you, then explain what is.
Are, by chance, you asking how to binarize an image, like with graythresh() and im2bw(), or imquantize(), or thresholding:
binaryImage = grayImage < thresholdValue;
Quantum  Foundation
Quantum Foundation 2014 年 12 月 16 日
type the variable name of that image in command window,then enter! You will get all the values of matrix. :)
Shyamala S
Shyamala S 2015 年 1 月 18 日
Can anyone help in converting an image into matrix value in MATLAB.....Pls reply me with corresponding code
Soma Debnath
Soma Debnath 2016 年 8 月 25 日
I am very new to MATLAB,so i have no idea that how to create and load training dataset of images in matlab?please write the corresponding code also.
snehal jaipurkar
snehal jaipurkar 2016 年 10 月 24 日
Dis is really helpful. I thanks experts for their support to beginners like usus.

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

Omar Omari
Omar Omari 2019 年 1 月 31 日

0 投票

hi readers
How can I take a picture from a camera my labtop and draw it into matrices and vice versa
Thanks
keerthana reddy
keerthana reddy 2019 年 2 月 14 日
編集済み: DGM 2024 年 4 月 23 日

0 投票

x=dicomread('i2.jpg');
Warning: Suspicious fragmentary file, might not be DICOM.
Warning: Not enough data imported. Attempted to read 1179258880 bytes at position 8. Only read 4733.
imshow(i2);
Unrecognized function or variable 'i2'.

2 件のコメント

Walter Roberson
Walter Roberson 2021 年 12 月 9 日
dicomread() is only for use with files stored in dicom format. There is no official file extension for dicom files but most people use .dcm or .dicom as the extension. In theory a file named with .jpg could be in dicom format instead of jpeg format, but the attached file is jpeg format not dicom format.
DGM
DGM 2024 年 4 月 23 日
As Walter said, the file is a JPG, not a DICOM file. Surprisingly, dicomread() only returns a warning and an empty array.
x = dicomread('i2.jpg');
Warning: Suspicious fragmentary file, might not be DICOM.
Warning: Not enough data imported. Attempted to read 1179258880 bytes at position 8. Only read 4733.
whos x
Name Size Bytes Class Attributes x 0x0 0 double
What's been missed is that x is never actually used. When imshow() is called, it's given the filename prefix as if it's a variable, even though it is neither a variable, nor a valid filename. Obviously, the result is going to be an error.
You can read pedestrian images with imread(). You can pass either a variable or a filename to imshow().
inpict = imread('i2.jpg');
imshow(inpict)

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

uroog fatima
uroog fatima 2021 年 12 月 9 日

0 投票

i need a command to convert encrpted image to matrix.can anybody tell me.

1 件のコメント

Walter Roberson
Walter Roberson 2021 年 12 月 9 日
No, we cannot help you with that. Due to the laws of the United States, we are not permitted to discuss encryption or decryption algorithms (except under narrow circumstances that are a nuisance to go through, requiring obtaining permission in advance from a government department.)

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

samitha chathuranga
samitha chathuranga 2024 年 4 月 23 日

0 投票

How to Design a communication system that uses digital modulation and channel coding with an LDPC code to simulate the transmission of digital images over an additive white Gaussian noise (AWGN) channel.

1 件のコメント

DGM
DGM 2024 年 4 月 23 日
This is not an answer, so it doesn't belong here as an answer.
If you want to ask a question, please post a new question using the "Ask" button at the top of the page.

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

カテゴリ

ヘルプ センター および File ExchangeConvert Image Type についてさらに検索

質問済み:

2012 年 4 月 27 日

コメント済み:

DGM
2024 年 4 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by