-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Closed
Milestone
Description
System Information
OpenCV version: 4.8.0
Operating System / Platform: openSUSE Tumbleweed (VERSION_ID="20231008")
Compiler & compiler version: gcc (SUSE Linux) 13.1.1 20230710 [revision f9781fcf733ca3afe5b5811afd8ecbb18d9d3a11]
Detailed description
Inside the function oclCvtColorBGR2HSV (color_hsv.dispatch.cpp) variables are defined as static so that they are initialized only once. That can lead to race conditions and OpenCL-context conflicts. Instead of static these variables should be declared static thead_local;
Steps to reproduce
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <thread>
int main() {
std::thread t([](){
cv::UMat src(cv::Size(1280, 720), CV_8UC3);
cv::UMat dst;
while(true) {
cvtColor(src, dst, cv::COLOR_BGR2HSV);
}
});
cv::UMat src(cv::Size(1280, 720), CV_8UC3);
cv::UMat dst;
while(true) {
cvtColor(src, dst, cv::COLOR_BGR2HSV);
}
}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 any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable