将自适应阈值应用于inrange函数opencv c ++(Applying adaptive thresholding to inrange function opencv c++)

编程入门 行业动态 更新时间:2024-10-28 11:18:36
将自适应阈值应用于inrange函数opencv c ++(Applying adaptive thresholding to inrange function opencv c++)

我想拍摄一个视频并从中创建一个二进制文件,我想要它,这样如果像素在一定范围内,它将被包含在二进制文件中。 换句话说,我想要像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);

更多推荐

本文发布于:2023-07-05 00:58:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1031213.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:阈值   应用于   自适应   函数   adaptive

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!