import numpy as np
import cv2
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
from scipy.stats import norm
imBGR = cv2.imread("../ressources/house.jpg")
patch_sky = cv2.imread("../ressources/sky_patch.png")
# Gaussian model for sky
means = np.array([np.mean(patch_sky[:, :, 0]), np.mean(patch_sky[:, :, 1]), np.mean(patch_sky[:, :, 2])])
var = np.array([np.var(patch_sky[:, :, 0]), np.var(patch_sky[:, :, 1]), np.var(patch_sky[:, :, 2])])
proba = multivariate_normal.pdf(imBGR, mean=means, cov=var)
print("proba shape:", np.shape(proba))
print("maximum probability:", np.max(proba))
问题在于所计算出的最大概率非常低:
proba shape: (960, 1280)
maximum probability: 0.00010730705050040148
我在做什么错了?