Created
April 22, 2012 21:17
-
-
Save semihozkoroglu/2466987 to your computer and use it in GitHub Desktop.
8x8 'lik matrisi zigzag yöntemi ile vektor biçimine dönüştürme işlemi.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Q = zigzag(I) | |
A = 16; | |
Q = [0]; | |
buyuk = 2; | |
katman = buyuk; | |
kucuk = 1; i = 1; j = 1; | |
while A > 0 | |
if (i ==1 & j == 1) | |
Q(length(Q)) = I(i,j); | |
j = j + 1; | |
else | |
if i < j | |
i = kucuk; | |
j = buyuk; | |
else | |
j = kucuk; | |
i = buyuk; | |
end | |
while katman > 0 | |
Q(length(Q) + 1) = I(i,j); | |
if i == buyuk | |
if mod(katman,2) == 0 | |
x_etiket = 1; | |
y_etiket = 0; | |
else | |
x_etiket = -1; | |
y_etiket = +1; | |
end | |
end | |
if j == buyuk | |
if ~(mod(katman,2) == 0) | |
x_etiket = 0; | |
y_etiket = 1; | |
else | |
x_etiket = +1; | |
y_etiket = -1; | |
end | |
end | |
katman = katman -1; | |
if ~(katman == 0) | |
i = i + x_etiket; | |
j = j + y_etiket; | |
end | |
end | |
if ~( buyuk == 8 ) | |
buyuk = buyuk + 1; | |
katman = buyuk; | |
elseif buyuk == 8 | |
kucuk = kucuk + 1; | |
katman = buyuk - kucuk +1; | |
end | |
end | |
A = A -1; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment