Ask Your Question

Revision history [back]

Running OpenCV SuperpixelSEEDS class without installing contrib module

I want to utilize SuperpixelSEEDS class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm described in:

Michael Van den Bergh, Xavier Boix, Gemma Roig, Luc Van Gool: SEEDS: Superpixels Extracted via Energy-Driven Sampling. International Journal of Computer Vision (IJCV), 2014.

Full documentation:

OpenCV-Superpixels

However, installing contrib module is not an option in this case since I will be integrating it to Android platform.

Is it possible to compile seeds.hpp along with the implementation seeds.cpp with opencv not compiled along with opencv_contrib module?

Here's one failed trial:

$ g++ -ggdb `pkg-config --cflags --libs opencv` seeds_sample.cpp seeds.cpp /tmp/ccwT1ohy.o: In function `cv::operator*=(cv::Mat&, double const&)': /usr/local/include/opencv2/core/operations.hpp:254: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const' /tmp/ccwT1ohy.o: In function `cv::operator&=(cv::Mat&, cv::Scalar_<double> const&)': /usr/local/include/opencv2/core.hpp:1143: undefined reference to `cv::noArray()' /tmp/ccwT1ohy.o: In function `cv::operator&=(cv::Mat&, cv::Scalar_<double> const&)': /usr/local/include/opencv2/core/operations.hpp:264: undefined reference to `cv::bitwise_and(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&)' /tmp/ccwT1ohy.o: In function `main': /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:41: undefined reference to `cv::VideoCapture::VideoCapture()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:48: undefined reference to `cv::VideoCapture::open(int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:53: undefined reference to `cv::imread(cv::String const&, int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:58: undefined reference to `cv::VideoCapture::isOpened() const' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:70: undefined reference to `cv::namedWindow(cv::String const&, int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:77: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:78: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:79: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:80: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:91: undefined reference to `vtable for cv::VideoCapture' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:93: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:107: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:109: undefined reference to `cv::getTickCount()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:114: undefined reference to `cv::getTickCount()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:114: undefined reference to `cv::getTickFrequency()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:124: undefined reference to `cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:130: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:133: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:142: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:148: undefined reference to `cv::waitKey(int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:155: undefined reference to `cv::VideoCapture::~VideoCapture()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:155: undefined reference to `cv::VideoCapture::~VideoCapture()' /tmp/ccwT1ohy.o: In function `cv::String::String(char const*)': /usr/local/include/opencv2/core/cvstd.hpp:618: undefined reference to `cv::String::allocate(unsigned int)' /tmp/ccwT1ohy.o: In function `cv::String::~String()': /usr/local/include/opencv2/core/cvstd.hpp:660: undefined reference to `cv::String::deallocate()' /tmp/ccwT1ohy.o: In function `cv::Mat::~Mat()': /usr/local/include/opencv2/core/mat.inl.hpp:556: undefined reference to `cv::fastFree(void*)' /tmp/ccwT1ohy.o: In function `cv::Mat::operator=(cv::Mat const&)': /usr/local/include/opencv2/core/mat.inl.hpp:577: undefined reference to `cv::Mat::copySize(cv::Mat const&)' /tmp/ccwT1ohy.o: In function `cv::Mat::release()': /usr/local/include/opencv2/core/mat.inl.hpp:667: undefined reference to `cv::Mat::deallocate()' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabels(cv::_OutputArray const&)': /home/cobalt/Workspace/SEEDS/seeds.cpp:240: undefined reference to `cv::_OutputArray::assign(cv::Mat const&) const' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::initialize(int, int)': /home/cobalt/Workspace/SEEDS/seeds.cpp:262: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::initImage(cv::_InputArray const&)': /home/cobalt/Workspace/SEEDS/seeds.cpp:386: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /home/cobalt/Workspace/SEEDS/seeds.cpp:387: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /home/cobalt/Workspace/SEEDS/seeds.cpp:388: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabelContourMask(cv::_OutputArray const&, bool)': /home/cobalt/Workspace/SEEDS/seeds.cpp:1189: undefined reference to `cv::_OutputArray::create(int, int, int, int, bool, int) const' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabelContourMask(cv::_OutputArray const&, bool)': /usr/local/include/opencv2/core/mat.hpp:1110: undefined reference to `cv::noArray()' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabelContourMask(cv::_OutputArray const&, bool)': /home/cobalt/Workspace/SEEDS/seeds.cpp:1191: undefined reference to `cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)' /tmp/ccTax62W.o: In function `cv::_InputArray::getMat(int) const': /usr/local/include/opencv2/core/mat.inl.hpp:123: undefined reference to `cv::_InputArray::kind() const' /usr/local/include/opencv2/core/mat.inl.hpp:125: undefined reference to `cv::_InputArray::getMat_(int) const' /tmp/ccTax62W.o: In function `cv::Mat::Mat(cv::Mat const&)': /usr/local/include/opencv2/core/mat.inl.hpp:389: undefined reference to `cv::Mat::copySize(cv::Mat const&)' /tmp/ccTax62W.o: In function `cv::Mat::create(int, int, int)': /usr/local/include/opencv2/core/mat.inl.hpp:648: undefined reference to `cv::Mat::create(int, int const*, int)' /tmp/ccTax62W.o: In function `SuperpixelSEEDS::~SuperpixelSEEDS()': /home/cobalt/Workspace/SEEDS/seeds.hpp:93: undefined reference to `cv::Algorithm::~Algorithm()' /tmp/ccTax62W.o: In function `SuperpixelSEEDS::SuperpixelSEEDS()': /home/cobalt/Workspace/SEEDS/seeds.hpp:18: undefined reference to `cv::Algorithm::Algorithm()' /tmp/ccTax62W.o:(.rodata._ZTV19SuperpixelSEEDSImpl[_ZTV19SuperpixelSEEDSImpl]+0x20): undefined reference to `cv::Algorithm::save(cv::String const&) const' /tmp/ccTax62W.o:(.rodata._ZTV19SuperpixelSEEDSImpl[_ZTV19SuperpixelSEEDSImpl]+0x24): undefined reference to `cv::Algorithm::getDefaultName() const' /tmp/ccTax62W.o:(.rodata._ZTV15SuperpixelSEEDS[_ZTV15SuperpixelSEEDS]+0x20): undefined reference to `cv::Algorithm::save(cv::String const&) const' /tmp/ccTax62W.o:(.rodata._ZTV15SuperpixelSEEDS[_ZTV15SuperpixelSEEDS]+0x24): undefined reference to `cv::Algorithm::getDefaultName() const' /tmp/ccTax62W.o:(.rodata._ZTI15SuperpixelSEEDS[_ZTI15SuperpixelSEEDS]+0x8): undefined reference to `typeinfo for cv::Algorithm' collect2: error: ld returned 1 exit status

Running OpenCV SuperpixelSEEDS class without installing contrib module

I want to utilize SuperpixelSEEDS class implementing the SEEDS (Superpixels Extracted via Energy-Driven Sampling) superpixels algorithm described in:

Michael Van den Bergh, Xavier Boix, Gemma Roig, Luc Van Gool: SEEDS: Superpixels Extracted via Energy-Driven Sampling. International Journal of Computer Vision (IJCV), 2014.

Full documentation:

OpenCV-Superpixels

However, installing contrib module is not an option in this case since I will be integrating it to Android platform.

Is it possible to compile seeds.hpp along with the implementation seeds.cpp with opencv not compiled along with opencv_contrib module?

Here's one failed trial:attempt:

$ g++ -ggdb `pkg-config --cflags --libs opencv` seeds_sample.cpp seeds.cpp /tmp/ccwT1ohy.o: In function `cv::operator*=(cv::Mat&, double const&)': /usr/local/include/opencv2/core/operations.hpp:254: undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const' /tmp/ccwT1ohy.o: In function `cv::operator&=(cv::Mat&, cv::Scalar_<double> const&)': /usr/local/include/opencv2/core.hpp:1143: undefined reference to `cv::noArray()' /tmp/ccwT1ohy.o: In function `cv::operator&=(cv::Mat&, cv::Scalar_<double> const&)': /usr/local/include/opencv2/core/operations.hpp:264: undefined reference to `cv::bitwise_and(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&)' /tmp/ccwT1ohy.o: In function `main': /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:41: undefined reference to `cv::VideoCapture::VideoCapture()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:48: undefined reference to `cv::VideoCapture::open(int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:53: undefined reference to `cv::imread(cv::String const&, int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:58: undefined reference to `cv::VideoCapture::isOpened() const' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:70: undefined reference to `cv::namedWindow(cv::String const&, int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:77: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:78: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:79: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:80: undefined reference to `cv::createTrackbar(cv::String const&, cv::String const&, int*, int, void (*)(int, void*), void*)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:91: undefined reference to `vtable for cv::VideoCapture' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:93: undefined reference to `cv::Mat::copyTo(cv::_OutputArray const&) const' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:107: undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:109: undefined reference to `cv::getTickCount()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:114: undefined reference to `cv::getTickCount()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:114: undefined reference to `cv::getTickFrequency()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:124: undefined reference to `cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:130: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:133: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:142: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:148: undefined reference to `cv::waitKey(int)' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:155: undefined reference to `cv::VideoCapture::~VideoCapture()' /home/cobalt/Workspace/SEEDS/seeds_sample.cpp:155: undefined reference to `cv::VideoCapture::~VideoCapture()' /tmp/ccwT1ohy.o: In function `cv::String::String(char const*)': /usr/local/include/opencv2/core/cvstd.hpp:618: undefined reference to `cv::String::allocate(unsigned int)' /tmp/ccwT1ohy.o: In function `cv::String::~String()': /usr/local/include/opencv2/core/cvstd.hpp:660: undefined reference to `cv::String::deallocate()' /tmp/ccwT1ohy.o: In function `cv::Mat::~Mat()': /usr/local/include/opencv2/core/mat.inl.hpp:556: undefined reference to `cv::fastFree(void*)' /tmp/ccwT1ohy.o: In function `cv::Mat::operator=(cv::Mat const&)': /usr/local/include/opencv2/core/mat.inl.hpp:577: undefined reference to `cv::Mat::copySize(cv::Mat const&)' /tmp/ccwT1ohy.o: In function `cv::Mat::release()': /usr/local/include/opencv2/core/mat.inl.hpp:667: undefined reference to `cv::Mat::deallocate()' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabels(cv::_OutputArray const&)': /home/cobalt/Workspace/SEEDS/seeds.cpp:240: undefined reference to `cv::_OutputArray::assign(cv::Mat const&) const' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::initialize(int, int)': /home/cobalt/Workspace/SEEDS/seeds.cpp:262: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::initImage(cv::_InputArray const&)': /home/cobalt/Workspace/SEEDS/seeds.cpp:386: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /home/cobalt/Workspace/SEEDS/seeds.cpp:387: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /home/cobalt/Workspace/SEEDS/seeds.cpp:388: undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabelContourMask(cv::_OutputArray const&, bool)': /home/cobalt/Workspace/SEEDS/seeds.cpp:1189: undefined reference to `cv::_OutputArray::create(int, int, int, int, bool, int) const' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabelContourMask(cv::_OutputArray const&, bool)': /usr/local/include/opencv2/core/mat.hpp:1110: undefined reference to `cv::noArray()' /tmp/ccTax62W.o: In function `SuperpixelSEEDSImpl::getLabelContourMask(cv::_OutputArray const&, bool)': /home/cobalt/Workspace/SEEDS/seeds.cpp:1191: undefined reference to `cv::Mat::setTo(cv::_InputArray const&, cv::_InputArray const&)' /tmp/ccTax62W.o: In function `cv::_InputArray::getMat(int) const': /usr/local/include/opencv2/core/mat.inl.hpp:123: undefined reference to `cv::_InputArray::kind() const' /usr/local/include/opencv2/core/mat.inl.hpp:125: undefined reference to `cv::_InputArray::getMat_(int) const' /tmp/ccTax62W.o: In function `cv::Mat::Mat(cv::Mat const&)': /usr/local/include/opencv2/core/mat.inl.hpp:389: undefined reference to `cv::Mat::copySize(cv::Mat const&)' /tmp/ccTax62W.o: In function `cv::Mat::create(int, int, int)': /usr/local/include/opencv2/core/mat.inl.hpp:648: undefined reference to `cv::Mat::create(int, int const*, int)' /tmp/ccTax62W.o: In function `SuperpixelSEEDS::~SuperpixelSEEDS()': /home/cobalt/Workspace/SEEDS/seeds.hpp:93: undefined reference to `cv::Algorithm::~Algorithm()' /tmp/ccTax62W.o: In function `SuperpixelSEEDS::SuperpixelSEEDS()': /home/cobalt/Workspace/SEEDS/seeds.hpp:18: undefined reference to `cv::Algorithm::Algorithm()' /tmp/ccTax62W.o:(.rodata._ZTV19SuperpixelSEEDSImpl[_ZTV19SuperpixelSEEDSImpl]+0x20): undefined reference to `cv::Algorithm::save(cv::String const&) const' /tmp/ccTax62W.o:(.rodata._ZTV19SuperpixelSEEDSImpl[_ZTV19SuperpixelSEEDSImpl]+0x24): undefined reference to `cv::Algorithm::getDefaultName() const' /tmp/ccTax62W.o:(.rodata._ZTV15SuperpixelSEEDS[_ZTV15SuperpixelSEEDS]+0x20): undefined reference to `cv::Algorithm::save(cv::String const&) const' /tmp/ccTax62W.o:(.rodata._ZTV15SuperpixelSEEDS[_ZTV15SuperpixelSEEDS]+0x24): undefined reference to `cv::Algorithm::getDefaultName() const' /tmp/ccTax62W.o:(.rodata._ZTI15SuperpixelSEEDS[_ZTI15SuperpixelSEEDS]+0x8): undefined reference to `typeinfo for cv::Algorithm' collect2: error: ld returned 1 exit status