Using ‘value‘ pointer is unsafe and deprecated. Use NULL as value pointer. To fetch trackbar value s

简介: 本文讨论了OpenCV中使用`createTrackbar`时遇到的"Using ‘value’ pointer is unsafe and deprecated"警告,并提供了通过设置空指针或使用回调函数来解决这个问题的方法。

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);

相关文章
|
4月前
Google Earth Engine(GEE)——当加载图表的时候出现错误No features contain non-null values of “system:time_start“.
Google Earth Engine(GEE)——当加载图表的时候出现错误No features contain non-null values of “system:time_start“.
99 0
|
SQL Java 数据库连接
mybatis 使用foreach时出现“The expression ‘list‘ evaluated to a null value“问题
mybatis 使用foreach时出现“The expression ‘list‘ evaluated to a null value“问题
1432 3
Kam
|
Java
java中使用@Value获取值为null问题解决:
java中使用@Value获取值为null问题解决
Kam
1106 0
|
1月前
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
解决微软云Azure Function运行报错-Value cannot be null. (Parameter ‘provider‘)
41 4
|
20天前
|
C++ Python
【Azure 应用服务】Azure Function Python函数部署到Azure后遇见 Value cannot be null. (Parameter 'receiverConnectionString') 错误
【Azure 应用服务】Azure Function Python函数部署到Azure后遇见 Value cannot be null. (Parameter 'receiverConnectionString') 错误
|
20天前
|
JavaScript 前端开发 C++
【Azure Function】调试 VS Code Javascript Function本地不能运行,报错 Value cannot be null. (Parameter 'provider')问题
【Azure Function】调试 VS Code Javascript Function本地不能运行,报错 Value cannot be null. (Parameter 'provider')问题
|
4月前
|
PHP
Trying to access array offset on value of type null
你就可以避免在null值上尝试访问数组偏移量的错误。 总的来说,当你遇到这个错误时,你应该回顾你的代码,确保在尝试访问数组偏移量之前,相关的变量已经被正确地初始化为一个数组,并且不是null。
1214 4
|
4月前
键值的 key 和 value 允许为null吗
键值的 key 和 value 允许为null吗
|
11月前
|
JavaScript API
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
193 0