简体   繁体   English

在量化图像上基于RGB值分割图像

[英]Segment Image based on RGB Value on Quantized image

How would I segment the background from an image that has already been quantized(n=5/6)? 我如何从已经量化(n = 5/6)的图像中分割背景?

Assuming, I have a clean background color that is only one color, I think filtering out everything by either the rgb value of the top left or top right pixel would work great. 假设我有一个干净的背景色,它只是一种颜色,我认为通过左上或右上像素的rgb值过滤掉所有内容都很好。

Ideally, I would like to avoid using openCV 理想情况下,我想避免使用openCV

Sample: 样品:

图片

Compare each pixel color to the pixel in the top-left corner. 将每种像素颜色与左上角的像素进行比较。 A pixel where all three layers of R, G, and B match is background: R,G和B的所有三层都匹配的像素是背景:

mask = np.all(image == image[0, 0, :], axis=2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM