Javascript¤ÇºÙÀþ²½

£²ÃͲ½²èÁü¤Î¥é¥¤¥ó¤òºÙÀþ²½¤¹¤ë¥¢¥ë¥´¥ê¥º¥à¤ÏÂô»³¤¢¤ê¤Þ¤¹¤¬¡¢
¥ë¡¼¥×²ó¿ô¤¬¤É¤¦¤·¤Æ¤â¿¤¯¤Ê¤ë¤Î¤Ç¡¢javascript¤Ç¤Î¼ÂÁõÎã¤Ï¾¯¤Ê¤¤¤Ç¤¹¡£

¤³¤³¤Ç¤Ï¡¢Èæ³ÓŪ¹â®¤ÊZhang-Suen, NWG¤È¡¢Åļ¤ÎÊý¼°¤ò¼ÂÁõ¤·¤Æ¤ß¤Þ¤¹¡£

¼Â¹Ô¥µ¥ó¥×¥ë¤Ï¤³¤Á¤é

Zhang-Suen¤Î¥¢¥ë¥´¥ê¥º¥à¤Ï¡¢Èæ³ÓŪñ½ã¤Ç¤¢¤ë¤Î¤Ç¼ÂÁõ¤·°×¤¤¤Ç¤¹¡£

¥é¥¹¥¿¥¹¥­¥ã¥ó¤Ë¤è¤ê²èÁǾðÊó¤òÆɤ߹þ¤ß¡¢
Ä´ºº²èÁǤò´Þ¤à¡¢3x3pix¤Î²èÁÇÃͤËÂФ·¡¢3¼ï¤Î¾ò·ï¤òËþ¤¿¤·¤Æ¤¤¤ì¤Ð¡¢
Ä´ºº²èÁǤòÇò(1)¤«¤é¹õ(0)¤ËÃÖ¤­´¹¤¨¤Þ¤¹¡£

Ä´ºº²èÁÇ(P1)¤ò´Þ¤à¡¢3x3pix¤Î²èÁǤ˼¡¤Î¤è¤¦¤ËÈÖ¹æ¤ò¿¶¤ë¡£


¾ò·ï£±¡¥
¡¡³°¼þ°ì¼þ¤òį¤á¤¿»þ¡¢
¡¡(P2->P3->P4->P5->P6->P7->P8->P9->P2)
¡¡¹õ¢ªÇò¤È¤Ê¤ëʤӤ¬°ì¤Ä¤À¤±¤Ç¤¢¤ë¤³¤È¡£

¡¡(±Ñʸ:A(P1)=number of 0,1 patterns(transitions from 0 to 1) in the ordered sequence of P2,P3,P4,P5,P6,P7,P8,P9,P2.
¡¡Condition: A(P1) = 1 )

¾ò·ï£²¡¥
¡¡³°¼þ¤Î²Ã»»(Çò¤Ê¤é+1)¤Î·ë²Ì(B)¤¬¡¢2<= B <=6¡¢¤òËþ¤¿¤¹¡£

¡¡(±Ñʸ:B(P1)=P2+P3+P4+P5+P6+P7+P8+P9 (number of nonzero neighbords of P1.)
¡¡Condition: 2 <= B(P1) <= 6 )

¾ò·ï£³(1)¡¥
¡¡P2 x P4 x P6 = 0 ¤«¤Ä¡¢P4 x P6 x P8 = 0 ¤òËþ¤¿¤¹¡£

¾ò·ï£³(2)¡¥
¡¡P2 x P4 x P8 = 0 ¤«¤Ä¡¢P2 x P6 x P8 = 0 ¤òËþ¤¿¤¹¡£

¤Þ¤º¡¢¾ò·ï£±¡¥£²¡¥£³(1)¤ÎȽÄê¤ò¹Ô¤¤¡¢¾ò·ï¤òËþ¤¿¤·¤¿¾ì¹ç¡¢³ºÅö²èÁǤò½üµî¥ê¥¹¥È¤ËÄɲ乤롣
Á´²èÁÇÄ´ºº¸å¡¢½üµî¥ê¥¹¥È¤Ë²èÁǤ¬¤¢¤ì¤Ð¡¢¤½¤Î²èÁǤòÁ´¤Æ¹õ(0)¤ËÊѤ¨¤ë¡£¤Ê¤±¤ì¤Ð½ªÎ»¤¹¤ë¡£

¼¡¤Ë¡¢¾ò·ï£±¡¥£²¡¥£³(2)¤ÎȽÄê¤ò¹Ô¤¤¡¢Æ±ÍͤνèÍý¤ò³¤±¤ë¡£
°Ê¹ß¡¢¾ò·ï£³(1)(2)¤òÀÚ¤êÂؤ¨¤Ê¤¬¤é¡¢¾ò·ï¤òËþ¤¿¤¹²èÁǤ¬¤Ê¤¯¤Ê¤ë¤Þ¤Ç¡¢·«¤êÊÖ¤·¹Ô¤¦¡£




NWG (Nagendraprasad-Wang-Gupta)¤Ë¤Ä¤¤¤Æ ¤Ï¡¢Zhang-Suen¤ÈÈó¾ï¤Ë»÷¤¿½èÍý¤Ç¤¢¤ë¤¿¤á¡¢
ÀâÌÀ¤Ï³ä°¦¤·¤Þ¤¹¡£
¾ÜºÙ¤Ï¡¢¥½¡¼¥¹¥³¡¼¥É¤«¡¢
A note on the Nagendraprasad-Wang-Gupta thinning algorithm ¤ò¤´Í÷¤¯¤À¤µ¤¤¡£




Zhang-Suen¤Î¥¢¥ë¥´¥ê¥º¥à¤¬¼ç¤Ë·×»»¤Ë¤è¤ëȽÄê¤ò¹Ô¤¦¤Î¤ËÂФ·¡¢
Åļ¤Î¥¢¥ë¥´¥ê¥º¥à¤Ï¡¢¿Þ·Á¤Î¥Þ¥Ã¥Á¥ó¥°¤òÍøÍѤ·¤Þ¤¹¡£

Âç¤Þ¤«¤Ê½èÍý¤È¤·¤Æ¤Ï¡¢
2¼ïÎà¤Î¥Ñ¥¿¡¼¥ó¤¬¤¢¤ê¡¢¤½¤ì¤¾¤ì¤Î¥Ñ¥¿¡¼¥ó¤Ï¡¢
3x3¤Î½üµî¥Ñ¥¿¡¼¥ó¤È3x3¤ÎÈó½üµî¥Ñ¥¿¡¼¥ó¤Ëʬ¤«¤ì¤ë¡£
¡Ê¤³¤³¤Ç¸À¤¦½üµî¤Ï¡¢Çò¤«¤é¹õ¤Ø¤ÎÊѹ¹¤ò°ÕÌ£¤¹¤ë¡£¡Ë

¥é¥¹¥¿¥¹¥­¥ã¥ó¤Ë¤è¤ê²èÁǾðÊó¤òÆɤ߹þ¤ß¡¢
³Æ²èÁǤˤĤ¤¤Æ3x3¤Î¥Ñ¥¿¡¼¥ó¥Þ¥Ã¥Á¥ó¥°¤ò¹Ô¤¦¡£

¥Ñ¥¿¡¼¥ó¤Ë¤Ï¼¡¤Î¤â¤Î¤¬¤¢¤ë¡£



¡Ú½èÍý³µÍסÛ

­¡ ¥Ñ¥¿¡¼¥ó£±¤Î½üµî¥Ñ¥¿¡¼¥ó¤Ç¥Þ¥Ã¥Á¥ó¥°¤¹¤ì¤Ð­¢¤Ø¡¢°ìÃפ·¤Ê¤±¤ì¤Ð¼¡²èÁǤء£
­¢ ¥Ñ¥¿¡¼¥ó£±¤ÎÈó½üµî¥Ñ¥¿¡¼¥ó¤Ç¥Þ¥Ã¥Á¥ó¥°¤¹¤ì¤Ð¼¡²èÁǤء¢°ìÃפ·¤Ê¤±¤ì¤Ð­£¤Ø¡£
­£ ³ºÅö²èÁǤò½üµî¥ê¥¹¥È¤ËÄɲä·¡¢¼¡²èÁǤء£
­¤ ­¡¡Á­£¤Î½èÍý¤òÁ´²èÁǤËÂФ·¤Æ¹Ô¤¦¡£
­¥ ½üµî¥ê¥¹¥È¤Ë²èÁǤ¬¤¢¤ì¤Ð¡¢¤½¤Î²èÁǤòÁ´¤Æ¹õ(0)¤ËÊѤ¨¤ë¡£¤Ê¤±¤ì¤Ð½ªÎ»¡£

­¦ ¥Ñ¥¿¡¼¥ó£²¤Î½üµî¥Ñ¥¿¡¼¥ó¤Ç¥Þ¥Ã¥Á¥ó¥°¤¹¤ì¤Ð­§¤Ø¡¢°ìÃפ·¤Ê¤±¤ì¤Ð¼¡²èÁǤء£
­§ ¥Ñ¥¿¡¼¥ó£²¤ÎÈó½üµî¥Ñ¥¿¡¼¥ó¤Ç¥Þ¥Ã¥Á¥ó¥°¤¹¤ì¤Ð¼¡²èÁǤء¢°ìÃפ·¤Ê¤±¤ì¤Ð­¨¤Ø¡£
­¨ ³ºÅö²èÁǤò½üµî¥ê¥¹¥È¤ËÄɲä·¡¢¼¡²èÁǤء£
­© ­¦¡Á­¨¤Î½èÍý¤òÁ´²èÁǤËÂФ·¤Æ¹Ô¤¦¡£
­ª ½üµî¥ê¥¹¥È¤Ë²èÁǤ¬¤¢¤ì¤Ð¡¢¤½¤Î²èÁǤòÁ´¤Æ¹õ(0)¤ËÊѤ¨¤ë¡£¤Ê¤±¤ì¤Ð½ªÎ»¡£
­« ­¡¤ËÌá¤ë¡£


¡Ú¥Þ¥Ã¥Á¥ó¥°¥³¡¼¥ÉÎã¡Û

ÀâÌÀ¤Î°Ù¤Ë¡¢3x3pix¤Çɽ¸½¤µ¤ì¤ë£±¤Ä¤Î¥Ñ¥¿¡¼¥ó¤ËP0¡ÁP8¤ÎÈÖ¹æ¤ò¿¶¤ê¤Þ¤¹¡£


P0¡ÁP8¤ò³Æ2bit¤Çɽ¤¹¤â¤Î¤È¤·¡¢
Çòbit:10, ¹õbit:01, ¤É¤Á¤é¤Ç¤âÎɤ¤¤â¤Î¤Ïbit:00¡¡¤È¤·¤Þ¤¹¡£
³ÆÎó¤ÎÀèƬ2bit¤Ë00¤òÉղä·¡¢£±¥Ð¥¤¥È/Îó¤Çɽ¸½¤¹¤ë¤È¡¢
£±¥Ñ¥¿¡¼¥ó¤Ï£³¥Ð¥¤¥È¤Ë¤Ê¤ê¤Þ¤¹¡£

Î㤨¤Ð¡¢¥Ñ¥¿¡¼¥ó£±¤Î½üµî¥Ñ¥¿¡¼¥ó¤Ç¤¢¤ì¤Ð¡¢


¤³¤³¤Ç¡¢¤¢¤ë²èÁǤò´Þ¤à3x3pix¤Î¾õÂÖ¤¬¼¡¤ÎÍͤˤʤäƤ¤¤ë¤È¤¹¤ë¤È

¤³¤ì¤Ï¡¢¥Ñ¥¿¡¼¥ó£±¡¦Èó½üµî¥Ñ¥¿¡¼¥ó¤Î6ÈÖÌܤȥޥåÁ¤·¤Þ¤¹¡£

Èó½üµî¥Ñ¥¿¡¼¥ó(6)¤Ï¡¢P = 0x040A04¤Çɽ¸½¤µ¤ì¤ë¤Î¤Ç

G AND P = P ¤¬À®¤êΩ¤Ä¡£

¤³¤ÎÏÀÍý¼°¤¬À®¤êΩ¤Ä¾ì¹ç¤Ë¡¢¥Ñ¥¿¡¼¥ó¥Þ¥Ã¥Á¤ÈǧÄê¤Ç¤­¤Þ¤¹¡£

Åļ¤ÎÊý¼°¤Ç¤Ï¡¢¤½¤ì¤Û¤É¥Ñ¥¿¡¼¥ó¤¬Â¿¤¯¤Ê¤¤¤Î¤Ç¡¢
³ä¤È´Êñ¤Ê¥³¡¼¥Ç¥£¥ó¥°¤ÇºÑ¤ß¤Þ¤¹¡£




<!DOCTYPE html>
<html>
<!-- 
// (c)Hundredsoft Corporation. 2013 All right reserved.
//
//    UTF-8¤ÇÊݸ¤·¤Æ²¼¤µ¤¤
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<title>ºÙÀþ²½¥µ¥ó¥×¥ë</title>

<script type="text/javascript">
//
// Zhang-Suen Algorithm
//
var zhangsuen = function(imgdata){
    var w = imgdata.width;
    var h = imgdata.height;
    var ind = imgdata.data;

    var x, y, rAry;
    var bFlag = true;

    for (var k=0; k<100 && bFlag; k++){
        if (!(k & 1)){
            bFlag = false;
        }
        rAry = new Uint8Array(ind);
        for (y=1; y<h-1; y++){
            for (x=1; x<w-1; x++){
                var i = (y*w + x)*4;
                if (rAry[i]){
                    var a,b,p1,p2,p3,p4,p5,p6,p7,p8,p9;
                    // [p9 p2 p3]
                    // [p8 p1 p4]
                    // [p7 p6 p5]
                    p1 = 1;
                    p2 = (rAry[i-w*4  ]) ? 1 : 0;
                    p3 = (rAry[i-w*4+4]) ? 1 : 0;
                    p4 = (rAry[i    +4]) ? 1 : 0;
                    p5 = (rAry[i+w*4+4]) ? 1 : 0;
                    p6 = (rAry[i+w*4  ]) ? 1 : 0;
                    p7 = (rAry[i+w*4-4]) ? 1 : 0;
                    p8 = (rAry[i    -4]) ? 1 : 0;
                    p9 = (rAry[i-w*4-4]) ? 1 : 0;
                    a = 0;
                    if (!p2 && p3){a++;}
                    if (!p3 && p4){a++;}
                    if (!p4 && p5){a++;}
                    if (!p5 && p6){a++;}
                    if (!p6 && p7){a++;}
                    if (!p7 && p8){a++;}
                    if (!p8 && p9){a++;}
                    if (!p9 && p2){a++;}
                    b = p2+p3+p4+p5+p6+p7+p8+p9;

                    if (a == 1 && 2 <= b && b <= 6){
                        if ((!(k & 1) && p2*p4*p6 == 0 && p4*p6*p8 == 0)
                         || ( (k & 1) && p2*p4*p8 == 0 && p2*p6*p8 == 0))
                        {
                            ind[i] = ind[i+1] = ind[i+2] = 0;
                            bFlag = true;
                        }
                    }
                }
            }
        }
    }
};

//
// NWG Algorithm
//
var nwg_method = function(imgdata){
    var w = imgdata.width;
    var h = imgdata.height;
    var ind = imgdata.data;

    var x, y, rAry;
    var bFlag = true;

    for (var k=0; k<100 && bFlag; k++){
        bFlag = false;
        rAry = new Uint8Array(ind);
        for (y=1; y<h-1; y++){
            for (x=1; x<w-1; x++){
                var i = (y*w + x)*4;
                if (rAry[i]){
                    var a,b,c,e,f,p0,p1,p2,p3,p4,p5,p6,p7;
                    // [p7 p0 p1]
                    // [p6    p2]
                    // [p5 p4 p3]
                    p0 = (rAry[i-w*4  ]) ? 1 : 0;
                    p1 = (rAry[i-w*4+4]) ? 1 : 0;
                    p2 = (rAry[i    +4]) ? 1 : 0;
                    p3 = (rAry[i+w*4+4]) ? 1 : 0;
                    p4 = (rAry[i+w*4  ]) ? 1 : 0;
                    p5 = (rAry[i+w*4-4]) ? 1 : 0;
                    p6 = (rAry[i    -4]) ? 1 : 0;
                    p7 = (rAry[i-w*4-4]) ? 1 : 0;
                    a = 0;
                    if (!p0 && p1){a++;}
                    if (!p1 && p2){a++;}
                    if (!p2 && p3){a++;}
                    if (!p3 && p4){a++;}
                    if (!p4 && p5){a++;}
                    if (!p5 && p6){a++;}
                    if (!p6 && p7){a++;}
                    if (!p7 && p0){a++;}
                    b = p0+p1+p2+p3+p4+p5+p6+p7;

                    if (2 <= b && b <= 6){
                        c = 0;
                        if ((p0+p1+p2+p5 == 0 && p4+p6 == 2)
                         || (p2+p3+p4+p7 == 0 && p0+p6 == 2)){
                            c = 1;
                        }
                        if (a == 1 || c == 1){
                            e = (p2+p4) * p0 * p6;
                            f = (p0+p6) * p2 * p4;
                            if ((!(k & 1) && e == 0)
                             || ( (k & 1) && f == 0)){
                                ind[i] = ind[i+1] = ind[i+2] = 0;
                                bFlag = true;
                            }
                        }
                    }
                }
            }
        }
    }
};

//
// Åļ Algorithm
//
var tamura = function(imgdata){
    // [p0 p1 p2]
    // [p3 p4 p5]
    // [p6 p7 p8]
    //
    // P[0-8]¤ò2bit¤Çɽ¤¹¡£Çòbit:10, ¹õbit:01, ¤½¤Î¾bit:00
    // ÀèƬ¤Ëbit00¤òÉղä·¡¢£±¥Ð¥¤¥È/Îó¤Ç£±¤Ä¤Î¥Ñ¥¿¡¼¥ó¤ò£³¥Ð¥¤¥È¤Çɽ¸½¡£
    // BitʤӤϡ¢00[p0][p1][p2]00[p3][p4][p5]00[p6][p7][p8]¤È¤¹¤ë¡£

    // ½üµî¤¹¤ë¥Ñ¥¿¡¼¥ó(1)
    var pat1  = new Array(0x040800, 0x000900);
    // ½üµî¤·¤Ê¤¤¥Ñ¥¿¡¼¥ó(1)
    var pat1n = new Array(0x040a09, 0x182900,
                0x001908, 0x042804, 0x081900, 0x040a04, 0x001824, 0x241800,
                0x060900, 0x000906, 0x192a11, 0x190a19, 0x112a19, 0x192819);

    // ½üµî¤¹¤ë¥Ñ¥¿¡¼¥ó(2)
    var pat2  = new Array(0x000804, 0x001800);
    // ½üµî¤·¤Ê¤¤¥Ñ¥¿¡¼¥ó(2)
    var pat2n = new Array(0x182804, 0x001a09,
                0x001908, 0x042804, 0x081900, 0x040a04, 0x001824, 0x241800,
                0x060900, 0x000906, 0x192a11, 0x190a19, 0x112a19, 0x192819);

    var w = imgdata.width;
    var h = imgdata.height;
    var ind = imgdata.data;

    var bFlag = true;
    for (var k=0; k<100 && bFlag; k++){
        bFlag = false;
        var rAry = new Uint8Array(ind);
        var pat, patn;
        if (k & 1){
            pat = pat2;
            patn = pat2n;
        }else{
            pat = pat1;
            patn = pat1n;
        }

        var x,y;
        for (y=1; y<h-1; y++){
            for (x=1; x<w-1; x++){
                var i = (y*w + x)*4;
                if (rAry[i]){
                    var f = 0x000800;

                    if (rAry[i-w*4-4]){f |= 0x200000;}
                    else              {f |= 0x100000;}
                    if (rAry[i-w*4    ]){f |= 0x080000;}
                    else              {f |= 0x040000;}
                    if (rAry[i-w*4+4]){f |= 0x020000;}
                    else              {f |= 0x010000;}
                    if (rAry[i      -4]){f |= 0x002000;}
                    else              {f |= 0x001000;}
//                    if (rAry[i        ]){f |= 0x000800;}
//                    else              {f |= 0x000400;}
                    if (rAry[i      +4]){f |= 0x000200;}
                    else              {f |= 0x000100;}
                    if (rAry[i+w*4-4]){f |= 0x000020;}
                    else              {f |= 0x000010;}
                    if (rAry[i+w*4    ]){f |= 0x000008;}
                    else              {f |= 0x000004;}
                    if (rAry[i+w*4+4]){f |= 0x000002;}
                    else              {f |= 0x000001;}

                    // ½üµî¤¹¤ë¥Ñ¥¿¡¼¥ó¤Ë°ìÃ×
                    if ((f & pat[0]) == pat[0] || (f & pat[1]) == pat[1]){
                        // ½üµî¤·¤Ê¤¤¥Ñ¥¿¡¼¥ó¤Ë°ìÃ×
                        if ((f & patn[ 0]) == patn[ 0] || (f & patn[ 1]) == patn[ 1]
                         || (f & patn[ 2]) == patn[ 2] || (f & patn[ 3]) == patn[ 3]
                         || (f & patn[ 4]) == patn[ 4] || (f & patn[ 5]) == patn[ 5]
                         || (f & patn[ 6]) == patn[ 6] || (f & patn[ 7]) == patn[ 7]
                         || (f & patn[ 8]) == patn[ 8] || (f & patn[ 9]) == patn[ 9]
                         || (f & patn[10]) == patn[10] || (f & patn[11]) == patn[11]
                         || (f & patn[12]) == patn[12] || (f & patn[13]) == patn[13]){
                            ;
                        }else{
                            ind[i] = ind[i+1] = ind[i+2] = 0;
                            bFlag = true;
                        }
                    }
                }
            }
        }
    }
};

var thinning = function(pattern){
    var chk = document.getElementById('difftm')
    var cvs = document.getElementById('IDcanvas')
    var ctx = cvs.getContext("2d");
    var imgdata = ctx.getImageData(0, 0, cvs.width, cvs.height);
    var stt = new Date;
    if (pattern == 0){
        tamura(imgdata);
    }else if (pattern == 1){
        zhangsuen(imgdata);
    }else{
        nwg_method(imgdata);
    }
    chk.innerHTML = "ConvertTime:" + ((new Date) - stt) + "ms";
    ctx.putImageData(imgdata, 0, 0);
};

var init = function(filename){
    var cvs = document.getElementById('IDcanvas')
    var ctx = cvs.getContext("2d");
    var img = new Image();
    img.onload = (function(){
        ctx.drawImage(img, 0, 0);
    });
    img.src = filename;
};
</script>
</head>

<body onload="init('test.png');">
<canvas id="IDcanvas" width="512" height="512"></canvas>
<hr />
<input type="button" value="²èÁü£±" style="width:100px; height:50px;" onclick="init('test.png'); return false;">
<input type="button" value="²èÁü£²" style="width:100px; height:50px;" onclick="init('test2.png'); return false;">
<input type="button" value="²èÁü£³" style="width:100px; height:50px;" onclick="init('test3.png'); return false;">
<br />
<input type="button" value="Åļ" style="width:100px; height:50px;" onclick="thinning('0'); return false;">
<input type="button" value="Zhang-Suen" style="width:100px; height:50px;" onclick="thinning('1'); return false;">
<input type="button" value="NWG" style="width:100px; height:50px;" onclick="thinning('2'); return false;">

<hr />
²èÁü¤òÁª¤ó¤Ç¤«¤é¡¢Åļ or Zhang-Suen oe NWG ¤ò¥¯¥ê¥Ã¥¯¡ª<br />
¡ÊChrome,FireFox¤À¤È0.5ÉÃÄøÅ٤Ǥ¹¤¬¡¢IE10¤À¤ÈÊÑ´¹¤Ë5ÉÃÄøÅٳݤê¤Þ¤¹¡£¡Ë<br />
<br />
<div id="difftm"></div>
</body>
</html>


ÀâÌÀ¤Ç¤Ïºï½ü¥ê¥¹¥È¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢¸µ¥Ç¡¼¥¿¤òTypedArray(Uint8Array)¤Ë¥³¥Ô¡¼¤·¤¿Êý¤¬Áᤫ¤Ã¤¿¤Î¤Ç¡¢
¼ÂÁõ¤Ç¤Ï¡¢ÊѤ¨¤Æ¤¤¤Þ¤¹¡£(ÆâÍÆŪ¤ËÊѤï¤ë¤â¤Î¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£)

Zhang-Suen,NWG,Åļ¤Ç¡¢¤É¤ÎÊýË¡¤¬Îɤ¤¤«¤Ï¡¢ÆþÎϲèÁü¤Ë¤è¤Ã¤ÆÊѤï¤ë¤Î¤Ç°ì³µ¤Ë¤Ï¸À¤¨¤Þ¤»¤ó¡£
¥µ¥ó¥×¥ë¤òÆ°¤«¤¹¤È¤ï¤«¤ê¤Þ¤¹¤¬¡¢½èÍý»þ´Ö¤Ë´Ø¤·¤Æ¤Ï¡¢NWG¤è¤ê¡¢Zhang-Suen¤ÎÊý¤¬Áᤤ¤Ç¤¹¡£
NWG¤Ï¡¢Zhang-Suen¤Î²þÎÉÈǤǤ¢¤ë¤¿¤á¼ã´³½èÍý¤¬Áý¤¨¤Æ¤¤¤ë¤¿¤á¤Ç¤¹¡£
¿Í´Ö¤ÎÌܤǸ«¤ë¤È¶Ï¤«¤Ê°ã¤¤¤Ç¤¹¤¬¡¢NWG¤ÎÊý¤¬åºÎï¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤è¤¦¤Ç¤¹¡£

Åļ¤Ë´Ø¤·¤Æ¤Ï¡¢¥µ¥ó¥×¥ë¤Î²èÁü£±¡¦²èÁü£²¤Ç¤Ï®ÅÙ¤¬Îô¤ê¤Þ¤¹¤¬¡¢²èÁü£³¤Ç¤Ï°µÅÝŪ¤ËÁᤤ¤Ç¤¹¡£
ʸ»ú·Ï¤Ç¤Ï̯¤Ê¤Ò¤²¤¬½Ð¤ä¤¹¤¤¤Ç¤¹¤¬¡¢¼Ì¿¿Åù¤Î¥¨¥Ã¥¸Ãê½Ð²èÁü¤ËÂФ·¤Æ¤ÏÎɤ¤·ë²Ì¤¬½Ð¤Æ¤¤¤Þ¤¹¡£

(ÏÀʸȯɽ½ç¤Ç¤Ï¡¢¡ÚHilditch(1968)¡Û¢ª¡ÚÅļ(1978)¡Û¢ª¡ÚZhang-Suen(1984)¡Û¢ª¡ÚNWG(1989)¡Û)

º£²ó¼ÂÁõ¤·¤Æ¤¤¤Þ¤»¤ó¤¬¡¢
Hilditch¤ÎÊýË¡¤ÏºÙÀþ²½½èÍý¤Î¸µÁĤȤâ¸À¤¨¤Þ¤¹¤¬¡¢½½Ê¬¤Ê·ë²Ì¤¬ÆÀ¤é¤ì¤Ê¤¤¾ì¹ç¤¬¤¢¤ë¤é¤·¤¤¡£
Rosenfeld¤Ï¡¢Zhang-Suen,NWG,Åļ¤ËÈæ¤Ù¡¢¤«¤Ê¤ê½èÍý¤¬½Å¤¯¤Ê¤ë¤é¤·¤¤¡£
¡Ê»²¹Í¡§ Comparing Hilditch, Rosenfeld, Zhang-Suen,and Nagendraprasad - Wang-Gupta Thinning ¡Ë


¼Â¹Ô¥µ¥ó¥×¥ë¤Ï¤³¤Á¤é


IE10/Chrome/FF/Android¤Ç¡¢³Îǧ¤·¤Æ¤¤¤Þ¤¹¡£

IE9¤Ï¡¢TypedArray(Uint8Array)¤ËÂбþ¤·¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢ºï½ü¥ê¥¹¥È¤ò»È¤¦Êý¼°¤Ë½¤Àµ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
IE10¤Ç¤â¡¢Uint8ClampedArray¡Ê˰ϱ黻ÉÕ¤­8bit¡Ë¤Ë¤ÏÂбþ¤·¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢
¤³¤Î¥µ¥ó¥×¥ë¤Ç¤Ï¡¢Uint8Array¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£
(Chrome,FF¤Ç¤Î¡¢ImageData.data¤Î·¿¤ÏUint8ClampedArray¤Ç¤¹¡£)

¤³¤Î¥ë¡¼¥×¿ô¤Ë¤Ê¤ë¤ÈChrome¤äFF¤Ï®¤¤¤Ç¤¹¤¬¡¢IE¤À¤È¤«¤Ê¤êÃÙ¤¤¤Î¤Ç¡¢
²èÁü¥µ¥¤¥º¤Ë¤è¤Ã¤Æ¤Ï¡¢Web Workers¤Ë¤è¤ë¥Þ¥ë¥Á¥¹¥ì¥Ã¥É²½¤ò¸¡Æ¤¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
⤷¡¢IE¤Ç¤ÏImageData.data¤Î·¿(CanvasPixelArray)¤¬°Û¤Ê¤ë¤Î¤Ç¡¢Ãí°Õ¤¬É¬ÍפǤ¹¡£


--------------- ʸ¸¥ ---------------
¡ÚÅļ¤ÎÊý¼°¡Û
H. Tamura: A comparison of line thinning algorithms from digital geometry viewpoint, Proc. 4th Int. Joint Conf. on Pattern Recognition, pp. 715 - 719 (1978.11)

¡ÚZhang-Suen¤ÎÊý¼°¡Û
Zhang, T. Y. and Suen, Ching Y., ¡ÈA Fast Parallel Algorithms ForThinning Digital Patterns¡É,Communication of the ACM,Vol 27, No. 3,Maret 1984, pp.236-239.

¡ÚNWG¤ÎÊý¼°¡Û
P.S.P. Wang and Y.Y. Zhang (1989). A fast and flexible thinning algo-rithm. IEEE Transactions on Computation C-38, 741–745




Tags: ¥×¥í¥°¥é¥à¥á¥â
author : HUNDREDSOFT | - | -