Imagehandler.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:QRCodeReader 作者: Griffintaur 项目源码 文件源码
def GetImageContour(self):
        thresholdImage = self.__convertImagetoBlackWhite()  #B & W with adaptive threshold
        thresholdImage = cv.Canny(thresholdImage, 100, 200) #Edges by canny edge detection
        thresholdImage, contours, hierarchy = cv.findContours(
            thresholdImage, cv.RETR_TREE, cv.CHAIN_APPROX_SIMPLE)
        self.Contours = contours
        # uncomment this to see the contours on the image
        # cv2.drawContours(thresholdImage, contours, -1, (0,255,0), 3)
        # patternFindingObj=PatternFinding()
        # areas= [cv.contourArea(contour) for contour in contours]
        # for index in xrange(len(contours)):
        #     IsPattern=self.IsPossibleQRContour(index)
        #     if IsPattern is True:
        #         x,y,w,h=cv.boundingRect(contours[index])
        #         cv.rectangle(self.imageOriginal,(x,y),(x+w,y+h),(0,0,255),2)
        #         cv.imshow("hello",self.imageOriginal)
        # maxAreaIndex=np.argmax(areas)
        # x,y,w,h=cv.boundingRect(contours[maxAreaIndex])
        # cv.rectangle(self.image2,(x,y),(x+w,y+h),(0,255,0),2)
        # cv.imshow("hello",self.imageOriginal)
        # cv.waitKey(0)
        #cv.destroyAllWindows()
        contour_group = (thresholdImage, contours, hierarchy)
        return contour_group
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号