代码:
Route {#109 ▼
+uri: "oauth/authorize"
+methods: array:2 [▶]
+action: array:6 [▼
"middleware" => array:2 [▼
0 => "web"
1 => "auth"
]
"uses" => "\Laravel\Passport\Http\Controllers\AuthorizationController@authorize"
"controller" => "\Laravel\Passport\Http\Controllers\AuthorizationController@authorize"
"namespace" => "\Laravel\Passport\Http\Controllers"
"prefix" => "oauth"
"where" => []
]
+controller: null
+defaults: []
+wheres: []
+parameters: null
+parameterNames: null
+computedMiddleware: null
+compiled: CompiledRoute {#203 ▶}
#router: Router {#21 ▶}
#container: Application {#3 ▶}
}
它抛出一个错误:
import numpy as np
import cv2
img = cv2.imread('/home/pi/Downloads/download.jpg',0)
cv2.imshow(img)
cv2.waitkey(0)
cv2.destroyAllWindows()
尝试使用opencv和python打开图像。但它显示出时髦的错误。此外,我对编程和opencv都很陌生。
由于
答案 0 :(得分:1)
OpenCV的cv2.imshow()
需要两个参数:
那么,你的错误TypeError: Required argument 'mat' (pos 2) not found
所说的是缺少第二个参数,因为该函数正在将img
变量解释为窗口名称。
除此之外,cv2.waitkey(0)
也会产生错误,正确的函数名称为cv2.waitKey(0)
(使用大写字母K)。
所以正确的代码是:
import numpy as np
import cv2
img = cv2.imread('/home/pi/Downloads/download.jpg',0)
cv2.imshow('My window',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
答案 1 :(得分:0)
您需要在cv2.imshow()
的第一个参数中传递窗口名称,例如cv2.imshow('image',img)