Python cv2.CV_LOAD_IMAGE_UNCHANGED Examples
The following are 6
code examples of cv2.CV_LOAD_IMAGE_UNCHANGED().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
cv2
, or try the search function
.
Example #1
Source File: helper.py From KittiSeg with MIT License | 5 votes |
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
Example #2
Source File: helper.py From KittiSeg with MIT License | 5 votes |
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
Example #3
Source File: helper.py From KittiSeg with MIT License | 5 votes |
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
Example #4
Source File: imagefeatures_rest.py From image_space with Apache License 2.0 | 5 votes |
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
Example #5
Source File: metric.py From SceneChangeDet with MIT License | 5 votes |
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
Example #6
Source File: flowlib.py From GeoNet with MIT License | 5 votes |
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