matlab crashes when running code on ~600 images
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
yonatan gerufi
le 1 Sep 2015
Réponse apportée : Image Analyst
le 1 Sep 2015
Hi,
i want to remove duplicate images from my portable hardDisk (win 7, 64 bit)
i have ~ 650 images, and i don't care about efficiency / running time (+ don't want to deal with memory issue's) so i wrote the following naive code with double for loop, that loads and compare each image separately, and if the images are equal adds to one filename "_double".
the code works on small amount of images, but running over ~ 600 matlab crashes:
tic
dir_path = pwd;
list = dir([dir_path '\*.jpg']);
DupCounter = 0;
fprintf('list size is %d \n',length(list));
fprintf('processing file ');
for i=1:length(list)-1
fprintf(' %d,', i);
if strfind( list(i).name,'_double')
continue;
end
currImage = imread(list(i).name);
for j=i+1:length(list)
if strfind( list(j).name,'_double')
continue;
end
nextImage = imread(list(j).name);
if isequal(currImage, nextImage)
movefile(list(j).name,strrep(list(j).name,'.jpg','_double.jpg')) % rename
list(j).name = strrep(list(j).name,'.jpg','_double.jpg'); % change name also in the list
DupCounter = DupCounter +1;
end
end
end
msg = sprintf('Total # duplicate frames: %d', DupCounter);
disp(msg)
toc
i get this massage:
Problem signature:
Problem Event Name: APPCRASH
Application Name: MATLAB.exe
Application Version: 8.1.0.0
Application Timestamp: 50f7698f
Fault Module Name: rjpg8c.mexw64
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 50f771f6
Exception Code: c0000005
Exception Offset: 00000000000048fd
OS Version: 6.1.7601.2.1.0.768.3
Locale ID: 1037
Additional Information 1: 2779
Additional Information 2: 277989f6aaa1d3ad64e8aeb5379db6ad
Additional Information 3: afc2
Additional Information 4: afc2f6520a6347247fd65c23f35ecb40
any idea?
0 commentaires
Réponse acceptée
Walter Roberson
le 1 Sep 2015
rjpg8c is the internal routine to read jpeg files. One possibility is that you have a corrupt jpg file. You could test that by looping and just reading them each once and seeing if that works. (You would of course output just before and after each imread() so you would be able to tell which file triggered the problem.)
0 commentaires
Plus de réponses (1)
Image Analyst
le 1 Sep 2015
Inside the j loop, have it print out the image it's processing.
fprintf('Comparing image#%d: %s, with image #%d: %s\n', ...
i, list(i).name, j, list(j).name);
In case it's crashing in the i loop on hte currImage line, but before the j loop, write out the i image name there:
fprintf('About to compare all other images to image #%d,: %s', i, list(i).name);
See if it's crashing on the same one all the time. See if you can call imread() on that image from the command line:
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!