Using ‘value’ pointer is unsafe and deprecated. Use NULL as value pointer. To fetch trackbar value setup callback.
现象:
在VS2019直接运行
createTrackbar(“Val Min”, “Trackbars”, &vmin, 255),没有设置回调函数直接运行时候就会发出上述警告,不过不影响运行。
可是这让我看着有点不爽。于是去查了查csdn一如既往的搜不到答案,在opencv Forun找到了。
原因:
the api is changing here, they are trying to get away from using “raw pointers” in the interface. so this:
解决方案
将报错的createTrackbar(“Hue min”, “Trackbars”, &hmin, 200, 0);
改成
createTrackbar(“Hue min”, “Trackbars”, nullptr, 200, 0);
setTrackbarPos(“Hue min”, “Trackbars”, hmin);
或
while(true) {
hmin = cv::getTrackbarPos(“Hue min”, “Trackbars”);
cv::Scalar lower(hmin, smin, vmin);