小编Mar*_* L.的帖子

方检测未找到方块

我使用的程序squares.c的OpenCV库的样本中找到.它适用于每个图像,但我真的无法弄清楚为什么它不能识别该图像中绘制的正方形

http://desmond.imageshack.us/Himg12/scaled.php?server=12&filename=26725680.jpg&res=medium

CANNY之后:http: //img847.imageshack.us/img847/6787/canny.jpg

DILATE之后:http: //img593.imageshack.us/img593/3010/dilate.jpg

RESULT图像(红色) http://img267.imageshack.us/img267/8016/resultuq.jpg

如您所见,未检测到方形.

在检测之后,我需要提取广场中包含的区域......没有投资回报率怎么可能?

c c++ opencv image-processing object-detection

14
推荐指数
2
解决办法
1万
查看次数

Python OpenCV - 在二进制图像中查找黑色区域

在Opencv的python包装器中有任何方法/函数可以在二进制图像中找到黑色区域吗?(就像Matlab中的regionprops)到目前为止,我加载了我的源图像,通过阈值将其转换为二进制图像,然后将其反转以突出显示黑色区域(现在是白色).

我不能使用第三方库,如cvblobslob或cvblob

python opencv colors detection threshold

14
推荐指数
2
解决办法
2万
查看次数

比较两个面孔(及其相似之处)

有没有办法比较两个面孔(可能与OpenCv)并获得他们的相似度?我的意思是应用面部识别算法,但仅限于两个面之间,而不是整个数据集.

问题在于,例如,特征需要至少2个训练图像.

opencv face-recognition

8
推荐指数
1
解决办法
1万
查看次数

OpenCV从正方形矢量中提取图像的区域

我有一个包含正方形的图像,我需要提取该正方形中包含的区域.在应用了square.c脚本(在每个OpenCV分布的样本中可用)后,我获得了一个正方形向量,然后我需要为它们中的每个保存一个图像.

用户karlphillip建议:

for (size_t x = 0; x < squares.size(); x++) 
{
    Rect roi(squares[x][0].x, squares[x][0].y, 
             squares[x][1].x - squares[x][0].x, 
             squares[x][3].y - squares[x][0].y);
    Mat subimage(image, roi);
}
Run Code Online (Sandbox Code Playgroud)

为了在原始图像中检测到的所有方块生成一个称为子图像的新Mat

正如卡尔记得的那样,图像中检测到的点可能并不代表一个完美的正方形(如上图所示),但我刚给你建议的代码假设他们这样做了.

实际上我收到了这个错误:

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width &&
      roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height &&
      roi.y + roi.height <= m.rows) in Mat, file /usr/include/opencv/cxmat.hpp, 
      line 187

terminate called after throwing an instance of 'cv::Exception'
what():  /usr/include/opencv/cxmat.hpp:187: error: …
Run Code Online (Sandbox Code Playgroud)

c++ opencv roi image-processing object-detection

4
推荐指数
1
解决办法
1万
查看次数

uCntu 11.10上的OpenCV

我刚刚将我的系统从ubuntu 11.04更新到11.10,现在我再也无法编译任何包含对OpenCV库的引用的C程序

我已经尝试重新安装OpenCV(我使用2.1版本),但我遇到了这个错误:

/tmp/ccArHTZL.o: In function `main':
z.c:(.text+0x59): undefined reference to `cvLoadImage'
z.c:(.text+0xa0): undefined reference to `cvNamedWindow'
z.c:(.text+0xb1): undefined reference to `cvShowImage'
z.c:(.text+0xbb): undefined reference to `cvWaitKey'
z.c:(.text+0xc5): undefined reference to `cvDestroyWindow'
z.c:(.text+0xd1): undefined reference to `cvReleaseImage'
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

为了安装OpenCV,我总是遵循这个过程:

$ sudo apt-get install libcv2.1 libcv-dev libcvaux2.1 libcvaux-dev libhighgui2.1
     libhighgui-dev opencv-doc python-opencv

$ export LD_LIBRARY_PATH=/home/opencv/lib
$ export PKG_CONFIG_PATH=/home/opencv/lib/pkgconfig

$ pkg-config --cflags opencv
     -I/usr/include/opencv

$ pkg-config --libs opencv
     -lcxcore -lcv -lhighgui -lcvaux -lml

$ g++ …
Run Code Online (Sandbox Code Playgroud)

c c++ ubuntu opencv

3
推荐指数
1
解决办法
9136
查看次数

Python中的OpenCV无法扫描像素

我遇到了 OpenCv 的 python 包装器的问题。如果黑色像素的数量大于阈值,我有这个函数返回 1

def checkBlackPixels( img, threshold ):
    width     = img.width
    height    = img.height
    nchannels = img.nChannels
    step      = img.widthStep
    dimtot   = width * height
    data = img.imageData
    black = 0

    for i in range( 0, height ):
        for j in range( 0, width ):
            r = data[i*step + j*nchannels + 0]
            g = data[i*step + j*nchannels + 1]
            b = data[i*step + j*nchannels + 2]

     if r == 0 and g == 0 and b == …
Run Code Online (Sandbox Code Playgroud)

python opencv pixels

1
推荐指数
1
解决办法
7640
查看次数

Python将unicode字符串转换并保存到列表中

我需要在列表中插入一系列名称(如'Alam\xc3\xa9'),而不是将它们保存到SQLite数据库中.

我知道我可以通过tiping正确渲染这些名称:

print eval(repr(NAME)).decode("utf-8")
Run Code Online (Sandbox Code Playgroud)

但我必须将它们插入列表中,所以我不能使用打印

没有打印的其他方法吗?

python unicode utf-8

0
推荐指数
1
解决办法
3837
查看次数