i want to create a database of images present in a folder by converting it to binary format.
can u pls share the procedure or the source code.
thank you

 Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 22 de Jul. de 2019
Editada: KALYAN ACHARJYA el 25 de Jul. de 2019

2 votos

Images=dir('C:\Complete_path\Input_folder_name\*.png'); %Input Images, Note on .format
outDirectory='C:\path_to create_out_folder\folder_name\'; % It will automatically ctreated
mkdir(outDirectory);
for i=1:length(Images)
ImgName=strcat('C:\Complete_path\Input_folder_name\',Images(i).name);
ImgName=imread(ImgName);
bw_image=im2bw(ImgName)
imwrite(bw_image,strcat(outDirectory,Images(i).name));
end
Please do minor change in the code, as per your requirements, any Issue let me know!

5 comentarios

Shreya Shetty
Shreya Shetty el 23 de Jul. de 2019
How to retrieve images from this database
KALYAN ACHARJYA
KALYAN ACHARJYA el 23 de Jul. de 2019
Editada: KALYAN ACHARJYA el 23 de Jul. de 2019
Yes, the first line is call the images from folder.
The code details:
Call the images from folder and convert to binary and save the binary image in different folder (with same image file name)
How to retrieve images from this database?
Do the same
Hope it helps!
Shreya Shetty
Shreya Shetty el 25 de Jul. de 2019
Error using rgb2gray>parse_inputs (line 81) MAP must be a mX3 array
Error in rgb2gray (line 35) X= parse_inputs(varargin{:});
Error in P1 (line 5) ImgName=rgb2gray(ImgName);
I am getting this error
KALYAN ACHARJYA
KALYAN ACHARJYA el 25 de Jul. de 2019
Editada: KALYAN ACHARJYA el 25 de Jul. de 2019
#Edited Answer Check
Are you sure your input images are RGB? May be your images are gray image, therefore skip the line.
Please do share complete code /replication code/sample images?
Shreya Shetty
Shreya Shetty el 25 de Jul. de 2019
Thank you

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 22 de Jul. de 2019

Comentada:

el 25 de Jul. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by