新しく発言する  EXIT  インデックスへ

画像8色化


  画像8色化 しばっち 2008/03/08 10:43:22 
  続き しばっち 2008/03/08 10:45:30 
Re: 画像8色化  返事を書く  ノートメニュー
しばっち <dihjvcfsyu> 2008/03/08 10:45:30
続き

CASE 3
SELECT CASE MD
CASE 1
CALL ERRORDIFF(BUFB, B1, X,RV)
IF RV<>0 THEN LET C = C + 1
CALL ERRORDIFF(BUFR, R1, X,RV)
IF RV<>0 THEN LET C = C + 2
CALL ERRORDIFF(BUFG, G1, X,RV)
IF RV<>0 THEN LET C = C + 4
CASE 2
CALL ERRORDIFF2(BUFB, B1, X,RV)
IF RV<>0 THEN LET C = C + 1
CALL ERRORDIFF2(BUFR, R1, X,RV)
IF RV<>0 THEN LET C = C + 2
CALL ERRORDIFF2(BUFG, G1, X,RV)
IF RV<>0 THEN LET C = C + 4
END SELECT
CASE 4
IF B1 > LEVEL THEN LET C = C + 1
IF R1 > LEVEL THEN LET C = C + 2
IF G1 > LEVEL THEN LET C = C + 4
END SELECT
CALL PSET(X,Y,R(C),G(C),B(C))
NEXT X
NEXT Y
100 DATA 0, 8, 2, 10
DATA 12, 4, 14, 6
DATA 3, 11, 1, 9
DATA 15, 7, 13, 5

200 DATA 0, 4, 1, 5
DATA 12, 8, 13, 9
DATA 3, 7, 2, 6
DATA 15, 11, 14, 10

300 DATA 10, 8, 9, 11
DATA 2, 0, 1, 3
DATA 6, 4, 5, 7
DATA 14, 12, 13, 15
END

EXTERNAL SUB ERRORDIFF (ERRBUF(,), LV, X,RV)
LET S = 0
FOR J = 0 TO 2
FOR I = -2 TO 2
IF X + I >= 0 AND X + I <= BIWIDTH - 1 THEN LET S = S + ERRBUF(X + I, J) * M(I, J)
NEXT I
NEXT J
LET S = (S + 24) / 48
IF S + LV > LEVEL THEN LET RV = 255 ELSE LET RV = 0
LET ERRBUF(X, 0) = S + LV - RV
IF X = BIWIDTH - 1 THEN
FOR XX = 0 TO BIWIDTH - 1
LET ERRBUF(XX, 2) = ERRBUF(XX, 1)
LET ERRBUF(XX, 1) = ERRBUF(XX, 0)
NEXT XX
END IF
END SUB

EXTERNAL SUB ERRORDIFF2 (ERRBUF(,), LV, X,RV)
LET S = 0
FOR J = 0 TO 1
FOR I = -1 TO 1
IF X + I >= 0 AND X + I <= BIWIDTH - 1 THEN LET S = S + ERRBUF(X + I, J) * M2(I, J)
NEXT I
NEXT J
LET S = (S + 8) / 16
IF S + LV > LEVEL THEN LET RV = 255 ELSE LET RV = 0
LET ERRBUF(X, 0) = S + LV - RV
IF X = BIWIDTH - 1 THEN
FOR XX = 0 TO BIWIDTH - 1
SWAP ERRBUF(XX, 1), ERRBUF(XX, 0)
NEXT XX
END IF
END SUB

EXTERNAL SUB MAKEMAT (MAT(,), N)
OPTION BASE 0
DIM DX(N * N), DY(N * N)
FOR J = 0 TO N - 1
FOR I = 0 TO N - 1
LET C = MAT(I, J)
LET DX(C) = I
LET DY(C) = J
NEXT I
NEXT J
LET COUNT = 0
FOR J = 0 TO N * N - 1
FOR I = 0 TO N * N - 1
LET X = N * DX(I) + DX(J)
LET Y = N * DY(I) + DY(J)
LET MAT(X, Y) = COUNT
LET COUNT = COUNT + 1
NEXT I
NEXT J
END SUB
   └続き しばっち 2008/03/08 10:46:13 
    └他のしきい値行列による組織的ディザ法 山中和義 2008/03/11 19:52:36  (修正1回)

 インデックスへ  EXIT
新規発言を反映させるにはブラウザの更新ボタンを押してください。