Pergunta

Estou tentando detectar pontos-chave do SIFT usando este código:

#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/nonfree/features2d.hpp"

[...]

Ptr<FeatureDetector> detector = FeatureDetector::create( "SIFT" );
vector<KeyPoint> keyPoints;
detector->detect( image, keyPoints );
The problem is that my detector pointer points to nowhere after that last line, and no error is shown in the console.

Estou usando o QtCreator e meu arquivo .pro contém:

LIBS += -lopencv_nonfree
CONFIG += link_pkgconfig
PKGCONFIG += opencv

então meu makefile contém:

LIBS          = $(SUBLIBS) -lopencv_nonfree [...]  /usr/local/lib/libopencv_nonfree.so [...]

Não há erro ao carregar as bibliotecas.

Eu instalei o opencv usando essas instruções.

Foi útil?

Solução

esqueci de ligar cv::initModule_nonfree(); antes de fazer qualquer outra coisa.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top