【问题标题】:Attempt to index global 'cv' (a nil value)尝试索引全局“cv”(零值)
【发布时间】:2016-06-14 07:19:30
【问题描述】:

操作系统:ubuntu

我正在尝试使用 cv 包中的函数检测给定图像中对象的边缘。

首先,我在我的 ubuntu 终端中运行“qlua”。

local cv = reuqire 'cv'
require 'cv'
reuqire 'image'
lena_p = image.load('/home/stone/codes/lena1.jpg')
image.dispaly(lena_p)
cv.rectangle{lena_p,{5,5},{10,10},color = {30,30,180},thickness = 2}
ca_l = cv.Canny{image=limg,threshold=1,threshold=10}

但是,它失败并出现以下错误:

[string "cv.rectangle{lena_p,{5,5},{10,10},color = {30..."]:1: 尝试索引全局 'cv' (一个 nil 值) 堆栈回溯: [string "cv.rectangle{lena_p,{5,5},{10,10},color = {30..."]:1: 在主块 [C]: at 0x7f6be51eaba0

[string "ca_l = cv.Canny{image=limg,threshold=1,thresh..."]:1: 尝试索引全局 'cv' (一个 nil 值) 堆栈回溯: [string "ca_l = cv.Canny{image=limg,threshold=1,thresh..."]:1: 在主块中 [C]:在 0x7feb66429ba0

我的问题是,如何使用 'cv' 包中的函数来检测对象轮廓?

参考: https://github.com/VisionLabs/torch-opencv/tree/master/cv

【问题讨论】:

  • 这是实际代码吗?你有 reuqire 而不是 require
  • 哦!上帝 !我的错 !我现在改正了。这是实际的代码。

标签: opencv contour object-detection torch canny-operator


【解决方案1】:

您缺少 torch-cv。您可以通过在终端中执行以下命令来安装它:

luarocks install cv

【讨论】:

    猜你喜欢
    • 2013-06-07
    • 2020-03-08
    • 2013-09-04
    • 1970-01-01
    • 1970-01-01
    • 2015-10-27
    • 2017-01-10
    • 2015-02-18
    • 2020-04-27
    相关资源
    最近更新 更多