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))
怎么保证第四图和其他三个大小一样呢