help with image processing code
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, i am new to matlab and need some help with this
i have used imread to read in a jpg image. however the workspace reads this as a 3 dimensional matrix, e.g. 150x100x3 uint8
how can i change this to a 2 dimensional matrix? i believe i have to use a gray scale image to accomplish this, but i cant seem to get it to work.
i have:
a = imread('image.jpg')
b = gray(a);
secondly, how can i read in a bunch of images into matlab for processing? i.e. i want to read in 1.jpg, 2.jpg, 3.jpg into the workspace. I know I need a for loop ,but i can't quite put the code together using the imread syntax.
for i = 1:5
a(i) = imread(xxxxx.jpg);
end
thank you
0 comentarios
Respuesta aceptada
Walter Roberson
el 11 de Jul. de 2011
b = rgb2gray(a);
2 comentarios
Walter Roberson
el 12 de Jul. de 2011
mydata{k} = imread(jpegFiles(k).name);
Notice the {k} instead of (k)
Más respuestas (1)
Ver también
Categorías
Más información sobre Convert Image Type 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!