当前位置: 首页>>代码示例>>Python>>正文


Python image.read_image_bgr方法代码示例

本文整理汇总了Python中keras_retinanet.utils.image.read_image_bgr方法的典型用法代码示例。如果您正苦于以下问题:Python image.read_image_bgr方法的具体用法?Python image.read_image_bgr怎么用?Python image.read_image_bgr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在keras_retinanet.utils.image的用法示例。


在下文中一共展示了image.read_image_bgr方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: viewImageFromURL

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def viewImageFromURL(url_pic):
	import requests, cv2
	from keras_retinanet.utils.image import read_image_bgr
	import matplotlib.pyplot as plt

	r = requests.get(url_pic, allow_redirects=True)
	image = read_image_bgr(BytesIO(r.content))

	# copy to draw on
	draw = image.copy()
	
	draw = cv2.cvtColor(draw, cv2.COLOR_BGR2RGB)


	plt.figure(figsize=(15, 15))
	plt.axis('off')
	plt.imshow(draw)
	plt.show() 
开发者ID:cad0p,项目名称:maskrcnn-modanet,代码行数:20,代码来源:instagram_impl.py

示例2: getImageFromURL

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def getImageFromURL(url_pic, draw=False):
	''' The image is the one that will be processed, the draw is the one to be shown '''
	import requests, cv2
	from keras_retinanet.utils.image import read_image_bgr

	r = requests.get(url_pic, allow_redirects=True)
	image = read_image_bgr(BytesIO(r.content))

	

	if draw:
		# copy to draw on
		draw = image.copy()
		
		draw = cv2.cvtColor(draw, cv2.COLOR_BGR2RGB)

		return image, draw
	else:
		return image 
开发者ID:cad0p,项目名称:maskrcnn-modanet,代码行数:21,代码来源:instagram_impl.py

示例3: getImageFromFilePath

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def getImageFromFilePath(img_path, draw=False):
	''' The image is the one that will be processed, the draw is the one to be shown '''
	import requests, cv2
	from keras_retinanet.utils.image import read_image_bgr

	image = read_image_bgr(img_path)

	

	if draw:
		# copy to draw on
		draw = image.copy()
		
		draw = cv2.cvtColor(draw, cv2.COLOR_BGR2RGB)

		return image, draw
	else:
		return image 
开发者ID:cad0p,项目名称:maskrcnn-modanet,代码行数:20,代码来源:instagram_impl.py

示例4: detect

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def detect(self, img_path, min_prob=0.6):
        image = read_image_bgr(img_path)
        image = preprocess_image(image)
        image, scale = resize_image(image)
        boxes, scores, labels = Detector.detection_model.predict_on_batch(np.expand_dims(image, axis=0))
        boxes /= scale
        processed_boxes = []
        for box, score, label in zip(boxes[0], scores[0], labels[0]):
            if score < min_prob:
                continue
            box = box.astype(int).tolist()
            label = Detector.classes[label]
            processed_boxes.append({'box': box, 'score': score, 'label': label})
            
        return processed_boxes 
开发者ID:notAI-tech,项目名称:NudeNet,代码行数:17,代码来源:detector.py

示例5: load_image

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def load_image(self, image_index):
        image_info = self.coco.loadImgs(self.image_ids[image_index])[0]
        path       = os.path.join(self.data_dir, 'images', image_info['file_name']) #, self.set_name
        return read_image_bgr(path) 
开发者ID:cad0p,项目名称:maskrcnn-modanet,代码行数:6,代码来源:coco.py

示例6: predict

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def predict(imagePath):
	# load the input image (in BGR order), clone it, and preprocess it
	image = read_image_bgr(imagePath)
	output = image.copy()
	image = preprocess_image(image)
	(image, scale) = resize_image(image)
	image = np.expand_dims(image, axis=0)

	# detect objects in the input image and correct for the image scale
	(boxes, scores, labels) = model.predict_on_batch(image)
	boxes /= scale

	# loop over the detections
	for (box, score, label) in zip(boxes[0], scores[0], labels[0]):
		# filter out weak detections
		if score < 0.5:
			continue
	
		# convert the bounding box coordinates from floats to integers
		box = box.astype("int")
	
		# build the label and draw the label + bounding box on the output
		# image
		label = "{}: {:.2f}".format(LABELS[label], score)
		cv2.rectangle(output, (box[0], box[1]), (box[2], box[3]),
			(0, 255, 0), 2)
		cv2.putText(output, label, (box[0], box[1] - 10),
			cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)

	# show the output image
	cv2.imwrite("prediction.jpg", output)
	return boxes 
开发者ID:holms-ur,项目名称:fine-tuning,代码行数:34,代码来源:predict.py

示例7: load_image

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def load_image(self, image_index):
        image_info = self.coco.loadImgs(self.image_ids[image_index])[0]
        path       = os.path.join(self.data_dir, 'images', self.set_name, image_info['file_name'])
        return read_image_bgr(path) 
开发者ID:fizyr,项目名称:keras-maskrcnn,代码行数:6,代码来源:coco.py

示例8: load_image

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def load_image(self, image_index):
        return read_image_bgr(self.image_path(image_index)) 
开发者ID:fizyr,项目名称:keras-maskrcnn,代码行数:4,代码来源:csv_generator.py

示例9: test_read_image_bgr

# 需要导入模块: from keras_retinanet.utils import image [as 别名]
# 或者: from keras_retinanet.utils.image import read_image_bgr [as 别名]
def test_read_image_bgr(tmp_path):
    stub_image_path = os.path.join(tmp_path, _STUB_IMG_FNAME)

    original_img = np.asarray(Image.open(
        stub_image_path).convert('RGB'))[:, :, ::-1]
    loaded_image = image.read_image_bgr(stub_image_path)

    # Assert images are equal
    np.testing.assert_array_equal(original_img, loaded_image) 
开发者ID:fizyr,项目名称:keras-retinanet,代码行数:11,代码来源:test_image.py


注:本文中的keras_retinanet.utils.image.read_image_bgr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。