cv2.imshow不显示整个图像

时间:2019-07-21 23:13:44

标签: object-detection cv2 object-detection-api imshow imread

以下代码未显示整个图像。如何为imshow定义自定义尺寸。任何帮助将不胜感激。

image = cv2.imread(PATH_TO_IMAGE)
image_expanded = np.expand_dims(image, axis=0)

# Perform the actual detection by running the model with the image as input
(boxes, scores, classes, num) = sess.run(
    [detection_boxes, detection_scores, detection_classes, num_detections],
    feed_dict={image_tensor: image_expanded})

# Draw the results of the detection (aka 'visulaize the results')

vis_util.visualize_boxes_and_labels_on_image_array(
    image,
    np.squeeze(boxes),
    np.squeeze(classes).astype(np.int32),
    np.squeeze(scores),
    category_index,
    use_normalized_coordinates=True,
    line_thickness=4,
    min_score_thresh=0.60)

# All the results have been drawn on image. Now display the image.
cv2.imshow('Road-Crack Detector', image)

# Press any key to close the image
cv2.waitKey(0)

# Clean up
cv2.destroyAllWindows()

0 个答案:

没有答案