當前位置: 首頁>>代碼示例>>Python>>正文


Python Rect.get_ragion方法代碼示例

本文整理匯總了Python中rect.Rect.get_ragion方法的典型用法代碼示例。如果您正苦於以下問題:Python Rect.get_ragion方法的具體用法?Python Rect.get_ragion怎麽用?Python Rect.get_ragion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rect.Rect的用法示例。


在下文中一共展示了Rect.get_ragion方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_rect_ragion

# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import get_ragion [as 別名]
 def get_rect_ragion(contour, the_image):
     '''
         Contour.get_rect_ragion
     '''
     return Rect.get_ragion(cv2.boundingRect(contour), the_image)
開發者ID:jichen3000,項目名稱:picture_sudoku,代碼行數:7,代碼來源:contour.py

示例2: rect

# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import get_ragion [as 別名]
 def rect(the_image, rect):
     rect_image = Rect.get_ragion(rect, the_image)
     Display.image(rect_image)
開發者ID:jichen3000,項目名稱:picture_sudoku,代碼行數:5,代碼來源:display.py

示例3: test

# 需要導入模塊: from rect import Rect [as 別名]
# 或者: from rect.Rect import get_ragion [as 別名]
    with test(Contour.get_rect_ragion):
        contour = numpy.array([[[ 171,  21]],
                               [[  18,  26]],
                               [[  25, 216]],
                               [[ 175, 212]]])
        '''
            notice the result will be different with different picture.
        '''
        part_image1 = Contour.get_rect_ragion(contour, gray_image)
        part_image1.shape.must_equal((196, 158))
        part_image1[0,0].must_equal(gray_image[21,18])
        # Display.image(part_image1)

        rect = (18, 21, 158, 196)
        cv2.boundingRect(contour).must_equal(rect)
        part_image2 = Rect.get_ragion(rect, gray_image)
        part_image2.shape.must_equal((196, 158))
        part_image2[0,0].must_equal(gray_image[21,18])
        ''' uncomment the below, you can see the consequence in a picture. '''
        # Display.image(part_image1)    

    with test(Contour.check_beyond_borders):
        contour = numpy. array(
              [[[ -1, 116]],
               [[334, 202]],
               [[318, 457]],
               [[ 74, 460]]])
        height, width = 800, 600
        the_image = Image.generate_mask((height, width))
        changed_contour = Contour.check_beyond_borders(contour, the_image.shape)
        changed_contour[0,0,0].must_equal(0)
開發者ID:jichen3000,項目名稱:picture_sudoku,代碼行數:33,代碼來源:contour.py


注:本文中的rect.Rect.get_ragion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。