How process all images in one Time
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have this code for only one image, How can i change code to process all images in one time.
clear all;
clc;
%% Getting the input images
% disp('Provide the main image...')
[img_file1, img_path1] = uigetfile({'*.png'});
img1 = imread([img_path1,img_file1]);
% disp('Provide the image to be concealed...')
[img_file2, img_path2] = uigetfile({'*.png'});
img2 = imread([img_path2,img_file2]);
%% Conditioning of images
%checking for coloured images
if length(size(img1))==3
img1 = rgb2gray(img1);
end
if length(size(img2))==3
img2 = rgb2gray(img2);
end
%checking for unequal sizes of both images
[r1,c1] = size(img1);
[r2,c2] = size(img2);
r = min(r1,r2);
c = min(c1,c2);
img1 = imresize(img1,[r c]);
img2 = imresize(img2,[r c]);
%% Performing steganography
disp('Performing steganography')
final_img = img1;
for i=1:r
for j=1:c
num1 = bitand(img1(i,j),248);
num2 = bitshift(img2(i,j),-5);
final_img(i,j) = bitor(num1,num2);
end
end
%% Recovering the concealed image
disp('Recovering the concealed image')
recovered_img = final_img;
for i=1:r
for j=1:c
recovered_img(i,j) = bitshift(final_img(i,j),5);
end
end
1 commentaire
Réponses (1)
Walter Roberson
le 4 Nov 2022
You cannot process all of the images at the same time. imread() is not able to read more than one file at a time.
You can read the files one at a time. If you make the files all the same size, you can potentially combine the contents into a single array and process the array.
if length(size(img1))==3
img1 = rgb2gray(img1);
I would remind you of the hint I gave at the end of my answer to your previous question,
in particular the bit about how augmented image data store can automatically resize files and automatically convert to color or gray.
0 commentaires
Voir également
Catégories
En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!