Borrar filtros
Borrar filtros

how should i compress the some multiple images by 1st converting to them gray scale and all images are supposed to be of same size.

2 visualizaciones (últimos 30 días)
how should i compress the some multiple images by 1st converting to them gray scale and all images are supposed to be of same size. here i tried to read 100s of images now i want to convert them to gray scale and then i supposed to compress them to make them of same dimensions...
myFolder = 'C:\Users\shree\Desktop\final data\1'; if ~isdir(myFolder) errorMessage = sprintf('Error: The following folder does not exist:\n%s', myFolder); uiwait(warndlg(errorMessage)); return; end filePattern = fullfile(myFolder, '*.jpg'); jpegFiles = dir(filePattern); for k = 1:length(jpegFiles) baseFileName = jpegFiles(k).name; fullFileName = fullfile(myFolder, baseFileName); %fprintf(1, 'Now reading %s\n', fullFileName); imageArray = imread(fullFileName); imshow(imageArray); % Display image. drawnow; % Force display to update immediately. end
apologize me for any mistakes.... Regards,,,

Respuesta aceptada

Nitin
Nitin el 6 de Mzo. de 2014
Editada: Nitin el 6 de Mzo. de 2014
This could be because you are using imshow.
Convert your image to grayscale using:
I = rgb2gray(img);
% Resize your image
I=imresize(I,[a,b]); specify the dimensions you want
% Finally write your image
% imwrite(I,'name.jpg');

Más respuestas (0)

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!

Translated by