问题描述
我正在尝试使用 inRange 函数执行阈值处理,以创建用于特征检测的游戏内项目的白色遮罩。我目前正在使用带有轻微高斯模糊的 inRange 函数来去除噪声,试图完全掩盖我图像中的项目。
与硬编码 HSV 值相比,是否有更自适应的阈值方法?我对 OpenCV 比较陌生,想知道是否有更有效/更精确的方法来执行此任务。
这是关于我目前如何通过阈值执行的代码,以及我的结果。
Mat mask,scene;
scene = imread("./inGameWeapon.png");
resize(scene,scene,Size(),(270.0 / scene.rows),(270.0 / scene.cols));
cv::GaussianBlur(scene,cv::Size(5,5),0);
cvtColor(scene,COLOR_BGR2HSV);
inRange(scene,Scalar(0,50,0),Scalar(200,92,100),mask); //Remove blue background
imshow("Threshold",mask);
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)