我在我的Linux(ubuntu 14.04)机器上安装了Opencv 2.4.8,它运行正常。当我尝试使用在线官方文档中的示例代码测试SURF描述符时,编译器没有为#include<opencv2/nonfree/nonfree.hpp>
从this链接我尝试更新非自由模块的opencv库但仍然没有成功。
为了简化历史,如何将SURF描述符包含到我的项目中,或者知道如何解决这个问题?
答案 0 :(得分:6)
sudo apt-get update
sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev
答案 1 :(得分:1)
构建opencv版本时需要启用void InsertGraphicElement(struct RasterGraphic* pA)
{
struct GraphicElement *newNode = malloc(sizeof(*newNode));
if (newNode == NULL) return;
newNode->fileName = malloc(256*sizeof(char));
if (newNode->fileName == NULL) return;
newNode->pNext = NULL;
printf("Insert a GraphicElement in the RasterGraphic\nPlease enter the GraphicElement filename: ");
scanf("%s", newNode->fileName);
if (pA->GraphicElements == NULL)
{
pA->GraphicElements = newNode;
}
else
{
struct GraphicElement *tempHead = pA->GraphicElements;
while(tempHead->pNext != NULL)
{
tempHead = tempHead->pNext;
}
tempHead->pNext = newNode;
}
pA->numNodes++;
if (pA->numNodes == 1){
printf("\nThis is the first GraphicElement in the list\n");
}
return;
}
。
我猜在提示命令OPENCV_ENABLE_NONFREE
但是,如果您更喜欢cmake GUI,请参见下图。 picture