我尝试了一些试验..我建立
cmake -D CMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX =/usr/local -D WITH_TBB = ON -D BUILD_NEW_PYTHON_SUPPORT = ON -D WITH_V4L = ON -D INSTALL_C_EXAMPLES = ON -D INSTALL_PYTHON_EXAMPLES = ON -D BUILD_EXAMPLES = ON -D WITH_QT = ON - D WITH_GTK = ON -D WITH_OPENGL = ON ..
如果我尝试python:
导入cv2
打印(cv2.版本)
3.2.0
我的完整代码:(https://www.solarianprogrammer.com/2016/09/17/install-opencv-3-with-python-3-on-windows/)
import cv2
image = cv2.imread("/home/reigin/Pictures/games.jpg")
gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow("Over the Clouds", image)
cv2.imshow("Over the Clouds - gray", gray_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
Run Code Online (Sandbox Code Playgroud)
我有错误:
cv2.imshow("Over the …Run Code Online (Sandbox Code Playgroud) 我知道这是一个已知主题,解决方案之一是将调用更改为同步。我仍然不清楚是否还有其他方法可以异步执行并在完整函数中获取数据?示例函数在成功函数中创建了一个新的资产对象,我想在完整的函数中获取对它的引用。
function getPresentation(item) {
$.ajax({
type: "GET",
url: item.Url,
success: function (data) {
assets.push(new asset(item.Type, item.Url, data));
},
complete: function () {
/// How to get here the reference for the newly created asset object?
/// how to alert(asset)?
},
error: function (req, status, error) {
alert('error');
}
});
}
Run Code Online (Sandbox Code Playgroud)