Ejemplo n.º 1
0
def fun7():
    baseDir = r"D:\chengxu\python\project\digitRecognise\com\huitong\gasMeterv1"
    imgdirname = ["data", "img","gasmeterHead","style1"]
    dirname = FileNameUtil.getDirname(baseDir,imgdirname)
    filelist = FileNameUtil.getPathFilenameList(dirname,".*\.jpg")

    interestLoweer = (0,0,100)
    interestUpper = (60,45,255)

    interestLoweer = (40, 35, 80)
    interestUpper = (105, 105, 230)

    for each in filelist:
        image = cv2.imread(each)

        cornerpoint = ImageTool.getInterestBoxCornerPointByColor(image,interestLoweer,interestUpper)
        title = os.path.basename(each)
        ImageTool.showBoxInImageByBoxCornerPoint(image, cornerpoint, title)
Ejemplo n.º 2
0
    def getLCDBox(self):
        """
        """
        shape = self._image.shape
        mid = int(shape[0] / 2)
        splitImageBox = (0, mid, shape[1], shape[0])
        splitImageGray = ImageTool.getCropImageByBox(self._grayImage,
                                                     splitImageBox)
        ImageTool.showImagePIL(splitImageGray)

        splitImage = ImageTool.getCropImageByBox(self._image, splitImageBox)

        retval, otsuImage = ImageTool.getOTSUGrayImage(splitImageGray)
        otsuImage = ImageTool.convertImgGray2BGR(otsuImage)

        lower = (250, 250, 250)
        upper = (255, 255, 255)
        lcdBoxCorner = ImageTool.getInterestBoxCornerPointByColor(
            otsuImage, lower, upper)
        lcdBox = ImageTool.getBoxFromBoxCorner(lcdBoxCorner)
        self._lcdBox = lcdBox

        ImageTool.showBoxInImageByBoxCornerPoint(splitImage, lcdBoxCorner,
                                                 "lcd")