Skip to content

Instantly share code, notes, and snippets.

@semihozkoroglu
Created February 1, 2012 19:45
Show Gist options
  • Save semihozkoroglu/1718869 to your computer and use it in GitHub Desktop.
Save semihozkoroglu/1718869 to your computer and use it in GitHub Desktop.
Görüntü lab final son soru cevabı..
function renk_sayisi=different()
I = imread('autumn.tif');
J = {};
[R C L] = size(I);
for r=1:R
for c=1:C
if ( bul(J,I(r,c,1),I(r,c,2),I(r,c,3)))
J{length(J)+1} = [I(r,c,1),I(r,c,2),I(r,c,3)];
end
end
end
renk_sayisi = length(J);
function ret = bul(J, x, y, z)
ret = 1; %yok olark ilkle
for i = J
if (J{1}(1) == x & J{1}(2) == y & J{1}(3) == z)
ret = 0; %bulduk
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment