Ask Your Question
0

undefined reference to `cv::detail::ExposureCompensator::createDefault(int)'

asked 2018-07-30 04:26:00 -0600

prafull.g gravatar image

updated 2018-07-30 06:34:13 -0600

berak gravatar image

Hello, my project was running successfully with openCV 3.3.0 version. when i upgrade openCV version to 3.4.2 I get below linking errors.

Eraser::exposureCompensate(cv::Mat&, cv::Mat&)':
 undefined reference to `cv::detail::ExposureCompensator::createDefault(int)'
undefined reference to `cv::detail::ExposureCompensator::feed(std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > const&, std::vector<cv::UMat, std::allocator<cv::UMat> > const&, std::vector<cv::UMat, std::allocator<cv::UMat> > const&)

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-07-30 05:08:17 -0600

LBerger gravatar image

updated 2018-07-30 05:11:08 -0600

Can you show us your code ? Which library do you give in link command line ?

This line works in opencv 4.0.0pre

    #include <opencv2/opencv.hpp>
    using namespace cv;
    using namespace cv::detail;
    void main(){
    Ptr<ExposureCompensator> algoCorrectExpo;
    algoCorrectExpo = ExposureCompensator::createDefault(ExposureCompensator::GAIN_BLOCKS);
edit flag offensive delete link more

Comments

1

In openCV 3.3.0 and 3.4.0 there was no issue. but from 3.4.1 version, i am facing problem.

#include <opencv2/imgproc.hpp>
#include <opencv2/core.hpp>
#include <opencv2/stitching/detail/exposure_compensate.hpp>
#include <opencv2/stitching/detail/util.hpp>


.....
const int expos_comp_type = detail::ExposureCompensator::GAIN_BLOCKS;
    Ptr<ExposureCompensator> compensator = ExposureCompensator::createDefault(expos_comp_type);

....
compensator->feed(corners, images_u, masks_u);

    // get the background img
    compensator->apply(0, corners[0], result, thresh_erase_mask);
prafull.g gravatar imageprafull.g ( 2018-07-30 05:21:43 -0600 )edit

Which library do you give in link command line ?

LBerger gravatar imageLBerger ( 2018-07-30 05:32:42 -0600 )edit

Are you sure that images_u and mask_u type is vector<umat> ?

LBerger gravatar imageLBerger ( 2018-07-30 07:13:01 -0600 )edit

please find code snippet: /++++++++++++++++++++/

void Eraser::exposureCompensate(Mat &match_img, Mat &result)
{
    const int expos_comp_type = detail::ExposureCompensator::GAIN_BLOCKS;
    Ptr<ExposureCompensator> compensator = ExposureCompensator::createDefault(expos_comp_type);
    ...
Mat resize_match_img;
    resize(match_img, resize_match_img, Size(0,0), scale_factor, scale_factor);
Mat resize_thresh_erase_mask;
    resize(thresh_erase_mask, resize_thresh_erase_mask, Size(0,0), scale_factor, scale_factor);
    vector<Point> corners;
vector<Mat> images, masks;
    vector<UMat> images_u, masks_u;
...
compensator->feed(corners, images_u, masks_u);
compensator->apply(0, corners[0], result, thresh_erase_mask);
prafull.g gravatar imageprafull.g ( 2018-07-30 22:54:40 -0600 )edit

@LBerger : Can you please help me resolving above issue ?

prafull.g gravatar imageprafull.g ( 2018-08-01 06:12:40 -0600 )edit

I don't know what could be the problem but I can compile and link and run this example using same method. What is thresh_erase_mask type ?

LBerger gravatar imageLBerger ( 2018-08-01 07:14:25 -0600 )edit

cv::Mat thresh_erase_mask, thresh_match_mask;

prafull.g gravatar imageprafull.g ( 2018-08-01 07:16:17 -0600 )edit

try with UMat (declared here)

LBerger gravatar imageLBerger ( 2018-08-01 07:26:03 -0600 )edit

I wonder, how UMat can solve linking problem. Eraser::exposureCompensate(cv::Mat&, cv::Mat&)': undefined reference to cv::detail::ExposureCompensator::createDefault(int)' undefined reference tocv::detail::ExposureCompensator::feed(std::vector<cv::point_<int>, std::allocator<cv::point_<int> > > const&, std::vector<cv::umat, std::allocator<cv::umat=""> > const&, std::vector<cv::umat, std::allocator<cv::umat=""> > const&)

openCV 4.0 is not available on openCV releases. So i can not test this version.

prafull.g gravatar imageprafull.g ( 2018-08-01 07:34:07 -0600 )edit

can you compile and link https://github.com/D-BookeR/Traitemen... or https://github.com/opencv/opencv/blob...

Just rebuild opencv 3.4.2 and of course there is no problem with stitchin module (example https://github.com/D-BookeR/Traitemen... or https://github.com/opencv/opencv/blob...)

LBerger gravatar imageLBerger ( 2018-08-01 08:10:11 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-07-30 04:26:00 -0600

Seen: 402 times

Last updated: Jul 30 '18