Skip to content

opencv from 4.5.3 to 4.5.4. cv::line not working with clang 12.0.1 but working with g++ 11.1.0 #20854

@elegracer

Description

@elegracer
System information (version)
  • OpenCV => 4.5.4
  • Operating System / Platform => ArchLinux
  • Compiler => clang 12.0.1
Detailed description

After upgrading opencv from 4.5.3 to 4.5.4, a simple cv::line program cannot work. Drawing a single line on a plain cv::Mat results in an unchanged image.

Steps to reproduce
#include <opencv2/opencv.hpp>

int main() {
    cv::Mat img(200, 200, CV_8UC3, CV_RGB(255, 255, 255));
    cv::arrowedLine(img, cv::Point(0, 0), cv::Point(100, 100), CV_RGB(255, 255, 0), 2, 8, 0);
    cv::imshow("img", img);
    cv::waitKey(0);
    return 0;
}

Compile it with clang 12.0.1 with the following command

clang++ -isystem /usr/include/opencv4 -O3 -DNDEBUG -fPIE -g -std=c++17 -o use_opencv use_opencv.cpp -lopencv_core -lopencv_features2d -lopencv_imgproc -lopencv_highgui

The shown image is plain white.

However, compile the same program with g++ 11.1.0, everything works as expected. A line is drawn on the white background.

g++ -isystem /usr/include/opencv4 -O3 -DNDEBUG -fPIE -g -std=c++17 -o use_opencv use_opencv.cpp -lopencv_core -lopencv_features2d -lopencv_imgproc -lopencv_highgui
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions