def detectBarcode(img,verbose):
height =img.shape[0]
conn=8;
width=img.shape[1]
dstx=cv2.Sobel(img,cv2.CV_64F,1,0,3) #¼Òº§ ¿¬»êÀÚ ¼öÆò
#dstx=cv2.convertScaleAbs(dstx)
dsty=cv2.Sobel(img,cv2.CV_64F,0,1,3)#¼Òº§¿¬»êÀÚ ¼öÁ÷
#dsty=cv2.convertScaleAbs(dsty)
dstx-dsty;#»¬»ù¿¬»ê
#dstx=cv2.convertScaleAbs(dstx)
#dstx=np.uint8(np.absolute(dstx))
for y in range(height):
for x in range(width):
if(dstx[y,x]<0):
dstx[y,x]=0.0; #»©¼ À½¼ö°ª³ª¿Â°Íµé 0À¸·Î
dstx= cv2.GaussianBlur(dstx,(3,3),0)#°¡¿ì½Ã¾È ÆòÈ°È ¼öÇà
#dstx=cv2.adaptiveThreshold(dstx, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY_INV, 21, 2)
th1,dstx=thresholding_image(dstx,127)#ÀÓ°èÈ
kernel = cv2.getStructuringElement(cv2.MORPH_RECT,(21,3)) #¸ðÆ÷·ÑÁö ±ä Á÷»ç°¢ÇüÀ¸·Î
dstx= cv2.morphologyEx(dstx,cv2.MORPH_CLOSE,kernel)#´ÝÈû¿¬»ê
kernel = cv2.getStructuringElement(cv2.MORPH_RECT,(1,3))#ÀÛÀº »ç°¢ÇüÀ¸·Î
dstx=cv2.erode(dstx,kernel,iterations=2)#ħ½Ä¿¬»ê
dstx=cv2.dilate(dstx,kernel,iterations=2)#ÆØÃ¢¿¬»ê
num_x,labels=cv2.connectedComponents(dstx,connectivity=conn)<--¿¡·¯°¡¶ä dstx‹š¹®¿¡
¿©±â¼ ¸Ç ¸¶Áö¸· ÁÙÀÌ ¿À·ù°¡³ª´Âµ¥ dstx¸¦ ³ÖÀ¸¸é ¿¡·¯°¡¶ß°í img¸¦ ³ÖÀ¸¸é ¿¡·¯°¡¾È¶ß³×¿ä ¤Ð¤Ð¿ÖÀÌ·¸ÁÕ (img µµ ÀÌÁø¿µ»óÀε¥...)
¹ÙÄÚµå °ËÃâ ÄÚµåÀÔ´Ï´Ù!