Sorting pictures.
- From: "Ben H" <nebabon@xxxxxxxxx>
- Date: Tue, 13 Mar 2007 00:29:43 -0500
Hi all.
Thanks in advance. Everyone is really helpful on here.
i am trying to check a bunch of images i have stored in various
directories for duplicates. so far i have this code below which only
checks on directory. and it also has a memory problem.
%% Attempt to check for duplicates
clear;
close all;
tic;
Num_Points = 100;
C=0;
All_Pics = struct('name',{},'data',{},'test_data',{},'bytes',{});
[Out,Error_Message] = fopen('Possible_Matches.txt','wt+');
fprintf(Out,'List of possible matches for pictures\n');
Base_Dir = dir;
Base_JPG = dir('*.jpg');
for i=1:length(Base_JPG)
if Base_JPG(i).isdir ==false
C=C+1;
All_Pics(C).name = Base_JPG(i).name;
All_Pics(C).data = imread(Base_JPG(i).name);
All_Pics(C).bytes = Base_JPG(i).bytes;
end
end
clear i C
for C = 1:length(All_Pics)
X_Len = length(All_Pics(C).data(:,1,1));
Y_Len = length(All_Pics(C).data(1,:,1));
X=1:X_Len/Num_Points:X_Len;
Y=1:Y_Len/Num_Points:Y_Len;
for x=1:Num_Points
for y =1:Num_Points
Holding(x,y,:)=All_Pics(C).data(round(X(x)),round(Y(y)),:);
% imshow(All_Pics(C).test_data)
end
end
All_Pics(C).test_data = im2double(Holding);
end
clear Holding X_Len Y_Len x y X Y C
% Loop to compare values
% Error_Mat = double(1);
i = 1;
for C = 1:length(All_Pics)-1
for M = C+1:length(All_Pics)
Error_Mat = abs(All_Pics(C).test_data -
All_Pics(M).test_data);
Error_Amount = sum(sum(Error_Mat));
Error_Total(i,:) = Error_Amount; i=i+1;
if Error_Amount <= 500
fprintf(Out,[All_Pics(C).name,'
',All_Pics(M).name,'\n']);
end
end
end
clear C M
Time_Taken = toc/60
fprintf(Out,'Time it took: %.2f minutes.',Time_Taken);
fclose(Out);
any ideas would be really helpful
.
- Prev by Date: serial port
- Next by Date: Re: How to vectorize comparison of an array with 2 others.
- Previous by thread: serial port
- Next by thread: Euclidean Distance help ??
- Index(es):
Relevant Pages
|