Sorting pictures.



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
.



Relevant Pages

  • Re: Searching a drive and copying files
    ... Unison, net/unison port, should be able to handle the duplicates ... rename corrupt images into this dir. ... shift @names; ... sub compare_as_text ...
    (freebsd-questions)
  • Re: More elegant code
    ... I just didn't move duplicates but it would be easy to add a -something after ... It's an image database. ... BrowseForSourceFolder creates the New Images list. ... folder is browsed to to find the collection folder for the project. ...
    (microsoft.public.access.formscoding)
  • Re: Deleting duplicates in F-Spot?
    ... I imported a bunch of images and I noticed there are a few duplicates. ... I have exactly the same problem, which makes me very hesitate of using F-Spot, ...
    (Ubuntu)
  • Re: Tidying up computer files
    ... There is a clever program I came across that does more than that. ... duplicates of images that have undergone editing or re-sizing. ... You could also get a thumbnail viewer and set it to display the ...
    (uk.legal)
  • Re: Clearing up mess made by FrontPage
    ... The more I thought about it the more I was coming to that opinion myself. ... Confirmation is always nice though 8-) ... No only does FP clutter the markup with propriety and deprecated code, but is also duplicates and duplicates and *duplicates* images used in the site and for their 'themes' support! ...
    (alt.html)