| ²é¿´: 315 | »Ø¸´: 0 | |||
| µ±Ç°Ö÷ÌâÒѾ´æµµ¡£ | |||
sdlj8051½ð³æ (ÖøÃûдÊÖ)
|
[½»Á÷]
ͼÏóÔöÇ¿--ÌݶÈÈñ»¯
|
||
|
ͼÏóÔöÇ¿--ÌݶÈÈñ»¯ 1¡¢Î¢·Ö·¨ ¡¡¡¡ÔÚͼÏóÖУ¬±ßÔµÊÇÓɻҶȼ¶ºÍÏàÁÚÓòµã²»Í¬µÄÏóËØµã¹¹³ÉµÄ¡£Òò¶ø£¬ÈôÏëÔöÇ¿±ßÔµ£¬¾ÍÓ¦¸ÃÍ»³öÏàÁÚµã¼äµÄ»Ò¶È¼¶µÄ±ä»¯¡£Î¢·ÖÔËËã¿ÉÓÃÀ´ÇóÐźŵı仯ÂÊ£¬Òò¶ø¾ßÓмÓÇ¿¸ßƵ·ÖÁ¿µÄ×÷Óá£Èç¹û½«ÆäÓ¦ÓÃÔÚͼÏóÉÏ£¬¿ÉʹͼÏóµÄÂÖÀªÇåÎú¡£ÓÉÓÚÎÒÃdz£³£ÎÞ·¨ÊÂÏÈÈ·¶¨ÂÖÀªµÄÈ¡Ïò£¬Òò¶øÌôÑ¡ÓÃÓÚÂÖÀªÔöÇ¿µÄ΢·ÖËã×Óʱ£¬±ØÐëÑ¡ÔñÄÇЩ²»¾ß±¸¿Õ¼ä·½ÏòÐԵĺ;ßÓÐÐýת²»±äµÄÏßÐÎ΢·ÖËã×Ó¡£ ¡¡¡¡Í¼Ïó´¦ÀíÖÐ×î³£ÓõÄ΢·Ö·½·¨ÊÇÇóÌݶȡ£¶ÔÓÚͼÏóf(x, y), ËüÔڵ㣨x,y£©´¦µÄÌݶÈÊÇÒ»¸öʸÁ¿¡£ ¡¡¡¡Î¢·ÖÔËËãÒ»°ãÓòî·ÖÀ´´úÌæ¡£³£ÓõIJî·ÖÐÎʽÓÐÁ½ÖÖ£º 1)¡¡GM(x,y)=|f(x,y)-f(x+1,y)|+|f(x,y)-f(x,y+1)| 2)¡¡GM(x,y)=|f(x,y)-f(x+1,y+1)|+|f(x+1,y)-f(x,y+1)| ¡¡¡¡ÀûÓòî·ÖÔËËãʱ£¬Í¼ÏóµÄ×îºóÒ»ÐкÍ×îºóÒ»ÁеÄÏóËØµÄÌݶÈÎÞ·¨ÇóµÃ£¬Ò»°ãÓÃǰһÐлòǰһÁеÄÌݶÈÖµ½üËÆ´úÌæ¡£ ¡¡¡¡Ëã³öÌݶȺóÈÃÌݶÈͼÏóµÄ»Ò¶ÈÖµg(x,y)µÈÓڸõãµÄÌݶȷù¶È£¬¼´g(x,y)=GM(x,y)¡£ÕâÊdz£Óõķ½·¨¡£ ¡¡¡¡»¹ÓоÍÊÇ£º ¡¡¡¡1) ¡¡¡¡¡¡¡¡¡¡¡¡ ¡¡¡¡2) ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡LgΪһָ¶¨µÄ»Ò¶ÈÖµ¡£ ¡¡¡¡3) ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡LbΪһ¶Ô±³¾°Ö¸¶¨µÄ»Ò¶ÈÖµ¡£ ¡¡¡¡4) ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Lg ºÍ Lb µÄÒâÒåͬÉÏ¡£ 2¡¢¾í»ý ¡¡¡¡Ò»°ã¿ÉʹÓÃÈçϸßͨÂ˲¨¾ØÕó£º 0 -1 0 -1 5 -1 0 -1 0 -1 -1 -1 -1 9 -1 -1 -1 -1 1 -2 1 -2 5 -2 1 -2 1 -1 -2 -1 -2 19 -2 -1 -2 -1 -2 1 -2 1 6 1 -2 1 -2 -------------------------------------------------------------------------------- ÏÂÃæÊÇ΢·Ö·¨µÚÒ»ÖÖ·½·¨µÄ³ÌÐò£¬ÊÊÓÃÓÚ»Ò½×ͼÏó¡£ /* Contents a_gradient Sharpen images with differential method */ #include #include #include #include #include #include #include extern int _cdecl checkrange_(imgdes *); /* Sharpen images. Returns NO_ERROR, BAD_RANGE, BAD_FAC, NO_EMM, EMM_ERR, NO_XMM, or XMM_ERR */ int _cdcel a_gradient(imgdes * srcimg, imgdes * desimg, int kind_method) { int pixel_gray_1, pixel_gray_2, pixel_gray_3, pixel_gray_4, j, k, i, l; int rcode=NO_ERROR; int sx, sy, ex, ey; int gradient; int kind; kind = kind_method; /* Check range of start, end position */ if (checkrange_(srcimg)) return (BAD_RANGE); if (kind != 1 && kind != 2) return (BAD_FAC); sx = srcimg->stx; sy = srcimg->sty; ex = srcimg->endx; ey = srcimg->endy; copyimgdes (srcimg, desimg); rcode = copyimage(srcimg, desimg); if (rcode != NO_ERROR) return (rcode); for (k= sx; k<= ex-1; k++) { for (j=sy; j<= ey-1; j++) { gradient = 0; if (kind ==1) { pixel_gray_1 = getpixelgray (srcimg, k, j); pixel_gray_2 = getpixelgray (srcimg, k+1, j); pixel_gray_3 = getpixelgray (srcimg, k, j); pixel_gray_4 = getpixelgray (srcimg, k, j+1); } else { pixel_gray_1 = getpixelgray (srcimg, k, j); pixel_gray_2 = getpixelgray (srcimg, k+1, j+1); pixel_gray_3 = getpixelgray (srcimg, k+1, j); pixel_gray_4 = getpixelgray (srcimg, k, j+1); } if (pixel_gray_1 < 0) return (pixel_gray_1); if (pixel_gray_2 < 0) return (pixel_gray_2); if (pixel_gray_3 < 0) return (pixel_gray_3); if (pixel_gray_4 < 0) return (pixel_gray_4); gradient = (int)(abs(pixel_gray_1 - pixel_gray_2)) + (int)(abs(pixel_gray_3 - pixel_gray_4)); if (gradient > 255) gradient = 255; rcode = setpixelgray(desimg, k, j, (UCHAR)gradient); if (rcode!=NO_ERROR) return (rcode); } } /* for last column and row */ for (j=sy; j<= ey-1; j++) { rcode=getpixelgray(desimg, ex-1, j); if (rcode!=NO_ERROR) return (rcode); rcode=setpixelgray(desimg, ex, j, rcode); if (rcode!=NO_ERROR) return (rcode); } for (k=sx; k<=sx-1; k++) { rcode = getpixelgray(desimg, k, ey-1); if (rcode!= NO_ERROR) return (rcode); rcode = setpixelgray (desimg, k, ey, rcode); if (rcode != NO_ERROR) return (rcode); } rcode = getpixelgray (desimg, ex-1, ey-1); if (rcode!= NO_ERROR) return (rcode); rcode = setpixelgray (desimg, ex, ey, rcode); if (rcode != NO_ERROR) return (rcode); } ¡¡ ¡¡¡¡³ÌÐòÖÐÓòÎÊýKINDÀ´Ñ¡Ôñ½üËÆ¼ÆËãÌݶȵÄÁ½ÖÖ·½·¨¡£ [ Last edited by »ÃÓ°ÎÞºÛ on 2006-10-17 at 09:05 ] |
» ²ÂÄãϲ»¶
Ò»Ö¾Ô¸»ªÄÏÀí¹¤´óѧ331·Ö²ÄÁÏÇóµ÷¼Á
ÒѾÓÐ11È˻ظ´
271Çóµ÷¼Á
ÒѾÓÐ40È˻ظ´
Çóµ÷¼ÁѧУ
ÒѾÓÐ3È˻ظ´
332Çóµ÷¼Á
ÒѾÓÐ15È˻ظ´
297Çóµ÷¼Á
ÒѾÓÐ25È˻ظ´
±¾¿ÆÎ÷¹¤´ó 324Çóµ÷¼Á
ÒѾÓÐ5È˻ظ´
297¹¤¿Æµ÷¼Á?
ÒѾÓÐ7È˻ظ´
µ÷¼Á
ÒѾÓÐ11È˻ظ´
08¹¤Ñ§ 309·ÖÇóµ÷¼Á
ÒѾÓÐ7È˻ظ´
¸÷λÀÏʦºÃ£¬Çóµ÷¼Á£¬±¾¿Æ211£¬Ò»Ö¾Ô¸Ìì½ò´óѧÉúÎïÓëҽҩѧ˶£¬²îÁ½Ãû¼ȡ¡£
ÒѾÓÐ9È˻ظ´














»Ø¸´´ËÂ¥