python matplotlib 绘制子图,如何保证大小相同

def show_img_bright(rgb,hsv,mask,masked):
    fig,(ax1,ax2,ax3,ax4) = plt.subplots(1,4,figsize=(10,10))
    ax1.imshow(rgb)
    ax2.imshow(hsv[:,:,2],cmap='gray')
    ax3.imshow(mask,cmap='gray')
    ax4.imshow(masked[:,:,2],cmap='gray')
    

def apply_bright_mask(mask,rgb_image):
    masked_hsv_image = np.copy(rgb_image)
    masked_hsv_image[mask == 0] = [0, 0, 0]
    return masked_hsv_image

def apply_resize(rgb_image):
    v = 5
    h = 10
    
    return rgb_image[v:-v,h:-h,:]

def create_feature_brightness(rgb_image):
    hsv_img = cv2.cvtColor(test_im, cv2.COLOR_RGB2HSV)
    lower_hsv = np.array(210) 
    upper_hsv = np.array(255)
    mask=cv2.inRange(hsv_img[:,:,2],lower_hsv,upper_hsv)
    masked_hsv_image = apply_bright_mask(mask,rgb_image)
    
    show_img_bright(rgb_image,hsv_img,mask,apply_resize(masked_hsv_image))
        

clipboard.png

怎么保证第四图和其他三个大小一样呢

阅读 4.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题