MATLAB: Creating an image database

database

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

Best Answer

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!