我正在尝试在heroku上部署一个应用程序并经历了几个问题.该应用程序正在我的IDE(Intellij)中工作,但当我尝试使用"heroku local -f Procfile.windows"运行它时,我收到此错误:
11:30:03 PM web.1 | 2016-05-24 23:30:03.491 WARN 10368 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
11:30:03 PM web.1 | 2016-05-24 23:30:03.505 ERROR 10368 --- [ main] o.s.boot.SpringApplication : Application startup failed
11:30:03 PM web.1 | org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due …Run Code Online (Sandbox Code Playgroud) 我是 openCV(使用 Python)和图像处理的新手,并试图开始一个我自己的项目来了解事情是如何工作的。我正在尝试从张开嘴巴的图像中选择牙齿。我能想到的最佳解决方案是将它与牙齿的模板相匹配,并尝试根据我从嘴巴图像中获得的轮廓来匹配形状。这可能不是最好的解决方案,但看起来确实很容易。
到目前为止,我的代码如下所示:
img = cv2.imread('resources/1.jpg', cv2.IMREAD_COLOR)
compare = cv2.imread('resources/template.jpg', cv2.IMREAD_GRAYSCALE)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.bilateralFilter(gray, 11, 17, 17)
edges = cv2.Canny(gray, 20, 10)
compare = cv2.Canny(compare, 200, 200)
contours, _ = cv2.findContours(gray.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
compare_contours, _2 = cv2.findContours(compare.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
for c in contours:
for c2 in compare_contours:
ret = cv2.matchShapes(c, c2, 1, 0.0)
if ret < 0.5:
peri = cv2.arcLength(c, True)
approx = cv2.approxPolyDP(c, 0.02 * peri, True)
cv2.drawContours(img, [approx], -1, (0, 255, 0), 7) …Run Code Online (Sandbox Code Playgroud) 我的代码中有问题,找不到适合的解决方案。我正在使用Python 2.7.10和OpenCV 3.0。我读取了两张图像,并希望将其中一张图片(模板)与另一张图片的轮廓进行匹配,但是出现以下错误:
error: (-215) count >= 0 && (depth == CV_32F || depth == CV_32S) in function cv::arcLength
Run Code Online (Sandbox Code Playgroud)
我的代码如下所示:
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.bilateralFilter(gray, 11, 10, 17)
edges = cv2.Canny(gray, 100, 20)
contours,hierarchy, _ = cv2.findContours(gray, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
for c in contours:
ret = cv2.matchShapes(c, compare, 1, 0.0)
if ret < 0.5:
peri = cv2.arcLength(c, True)
approx = cv2.approxPolyDP(c, 0.02 * peri, True)
Run Code Online (Sandbox Code Playgroud)
灰度图像和比较图像均为灰度图像。该错误显然是在说我需要数组为浮点数或双精度数,但我不知道如何在python中进行转换,并且发现了许多函数正常工作的示例,并且代码似乎几乎相同。
此外,在大多数应用程序中,我注意到在大多数示例中,findContours()函数返回2个值,但如果不给出3则出现错误。
请帮我找到问题!