2

I have following line of codes

#include <opencv2/opencv.hpp>
#include <cv_bridge/cv_bridge.h>

...

cv::Mat color_image = cv::imread(file_path);

std_msgs::Header dummy_header;
cv_bridge::CvImage cv_image(dummy_header, "bgr8", color_image);

return cv_image.toImageMsg();

with following lines in my CMakeList.txt

find_package(OpenCV 4 REQUIRED COMPONENTS core calib3d imgcodecs highgui)

## Find catkin macros and libraries
find_package(catkin REQUIRED COMPONENTS
    cv_bridge
)

Unfortunately, this file causes the following error.

OpenCV Error: Assertion failed (tlsSlots.size() > slotIdx) in releaseSlot, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/system.cpp, line 1092
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/src/system.cpp:1092: error: (-215) tlsSlots.size() > slotIdx in function releaseSlot

Aborted (core dumped)

I couldn't figure out what is going wrong but one thing suspicious is that the error is from opencv-3.2. even though I am building with opencv 4.2.

Does anyone know what I have done wrong?

Brandon Lee
  • 391
  • 1
  • 3
  • 6

0 Answers0