We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
def otsu_binarization(img, th=128): max_sigma = 0 max_t = 0 # determine threshold for _t in range(1, 255): v0 = out[np.where(out < _t)] m0 = np.mean(v0) if len(v0) > 0 else 0. w0 = len(v0) / (H * W) v1 = out[np.where(out >= _t)] m1 = np.mean(v1) if len(v1) > 0 else 0. w1 = len(v1) / (H * W) sigma = w0 * w1 * ((m0 - m1) ** 2) if sigma > max_sigma: max_sigma = sigma max_t = _t # Binarization print("threshold =", max_t) th = max_t out[out < th] = 0 out[out >= th] = 255 return out
作者v0 = out[np.where(out < _t)]中的out可能是指函数传入参的img吧,不是太理解
v0 = out[np.where(out < _t)]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
作者
v0 = out[np.where(out < _t)]
中的out可能是指函数传入参的img吧,不是太理解The text was updated successfully, but these errors were encountered: