[英]Applying adaptive thresholding to inrange function opencv c++
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. 换句话说,我想要像
inRange()
函数中的上下边界,而不是像threshold()
函数中的简单截止点。
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. 我知道有
inRange()
做前者,而adaptiveThreshold()
做inRange()
,但是我不知道是否有两种方法都可以。
Apply adaptiveThreshold() to the whole original image, then apply inRange() to the original image and use the result of inRange() as a mask: 将adaptiveThreshold()应用于整个原始图像,然后将inRange()应用于原始图像,并使用inRange()的结果作为蒙版:
adaptiveThreshold(original_image, dst_image ... );
inRange(original_image, minArray, maxArray, mask);
Mat output = dst_image.mul(mask);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.