Which image is not like the others?
Afficher commentaires plus anciens
I have four RGB images I1, I2, I3, and I4. 3 of them are exactly the same, and one is different. Is there an elegant solution to find which image is different? Currently, I'm using something like the following.
if ~isequal(I1, I2) & ~isequal(I1, I3) & ~isequal(I1, I4)
dif = I1
elseif ~isequal(I2, I1) & ~isequal(I2, I3) & ~isequal(I2, I4)
dif = I2
%etc.
end
Réponse acceptée
Plus de réponses (1)
n = numel(I1) ;
if nnz(I1==I2==I3) == n
dif = I4 ;
elseif nnz(I2==I3==I4) == n
dif = I1 ;
elseif nnz(I3==I4==I1) == n
dif = I2 ;
else
dif = I3 ;
end
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!