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


Python cv2.CV_LOAD_IMAGE_UNCHANGED屬性代碼示例

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


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

示例1: getGroundTruth

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_LOAD_IMAGE_UNCHANGED [as 別名]
def getGroundTruth(fileNameGT):
    '''
    Returns the ground truth maps for roadArea and the validArea 
    :param fileNameGT:
    '''
    # Read GT
    assert os.path.isfile(fileNameGT), 'Cannot find: %s' % fileNameGT
    full_gt = cv2.imread(fileNameGT, cv2.CV_LOAD_IMAGE_UNCHANGED)
    #attention: OpenCV reads in as BGR, so first channel has Blue / road GT
    roadArea =  full_gt[:,:,0] > 0
    validArea = full_gt[:,:,2] > 0

    return roadArea, validArea 
開發者ID:MarvinTeichmann,項目名稱:KittiSeg,代碼行數:15,代碼來源:helper.py

示例2: getImageFeatures

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_LOAD_IMAGE_UNCHANGED [as 別名]
def getImageFeatures(self, params):
        try:
            import cv2
            import numpy as np
            cv2_available = True
        except ImportError:
            cv2_available = False

        # Disabling opencv for now
        cv2_available = False

        if 'url' in params:
            data = requests.get(params['url'], verify=False).content
        else:
            data = str(cherrypy.request.body.read())

        # Run Tika once
        parsed = parser.from_buffer(data)
        tika = {}
        for (k, v) in parsed["metadata"].iteritems():
            k = k.lower().replace(':', '_').replace(' ', '_').replace('-', '_')
            tika[k] = v[0] if type(v) is list and len(v) else v
        tika['content'] = parsed["content"]

        if cv2_available:
            file_bytes = np.asarray(bytearray(data), dtype=np.uint8)
            image = cv2.imdecode(file_bytes, flags=cv2.CV_LOAD_IMAGE_UNCHANGED)

            if image is not None:
                if len(image.shape) < 3 or image.shape[2] == 1:
                    image = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)

                v = cv2.calcHist([image], [0, 1, 2], None, [8, 8, 8], [0, 256, 0, 256, 0, 256])
                v = v.flatten()
                hist = v / sum(v)
                tika['histogram'] = hist.tolist()

        tika['sha1sum_s_md'] = hashlib.sha1(bytearray(data)).hexdigest()

        return tika 
開發者ID:nasa-jpl-memex,項目名稱:image_space,代碼行數:42,代碼來源:imagefeatures_rest.py

示例3: read_kitti_png_file

# 需要導入模塊: import cv2 [as 別名]
# 或者: from cv2 import CV_LOAD_IMAGE_UNCHANGED [as 別名]
def read_kitti_png_file(flow_file):
    # print flow_file
    flow_img = cv2.imread(flow_file, cv2.CV_LOAD_IMAGE_UNCHANGED)
    flow_img = flow_img.astype(float)
    # print flow_img.shape
    flow_data = np.zeros(flow_img.shape, dtype = np.float)
    flow_data[:, :, 0] = (flow_img[:, :, 2] - 2 ** 15) / 64.0
    flow_data[:, :, 1] = (flow_img[:, :, 1] - 2 ** 15) / 64.0
    flow_data[:, :, 2] = flow_img[:, :, 0]
    return flow_data 
開發者ID:yzcjtr,項目名稱:GeoNet,代碼行數:12,代碼來源:flowlib.py


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