我想拍摄一个视频并从中创建一个二进制文件,我想要它,这样如果像素在一定范围内,它将被包含在二进制文件中。 换句话说,我想要像inRange()函数中的上限和下限,而不是像inRange()函数中那样的简单截止点。
我还想使用自适应阈值来解释视频中的光照差异。 有没有办法做到这一点? 我知道inRange()执行前者和adaptiveThreshold()执行后者,但我不知道是否有办法同时执行这两个操作。
I want to take a video and create a binary from it, I want it so that if the pixel is within a certain range it will be included within the binary. In other words I want an upper and lower bound like in the inRange() function as opposed to a simple cutoff point like in the threshold() function.
I also want to use adaptive thresholding to account for differences in lighting in my video. Is there a way to do this? I know there is inRange() that does the former and adaptiveThreshold() that does the latter, but I don't know if there is a way to do both.
最满意答案
将adaptiveThreshold()应用于整个原始图像,然后将inRange()应用于原始图像,并使用inRange()的结果作为掩码:
adaptiveThreshold(original_image, dst_image ... ); inRange(original_image, minArray, maxArray, mask); Mat output = dst_image.mul(mask);Apply adaptiveThreshold() to the whole original image, then apply inRange() to the original image and use the result of inRange() as a mask:
adaptiveThreshold(original_image, dst_image ... ); inRange(original_image, minArray, maxArray, mask); Mat output = dst_image.mul(mask);更多推荐
发布评论