Skip to content

remove(tmp_fname.c_str()) fails in test_jpegxl.cpp #26766

@sturkmen72

Description

@sturkmen72

System Information

OpenCV version: 4.12.0-dev
Operating System: Windows 11
Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe (ver 19.37.32822.0)

Detailed description

in test_jpegxl.cpp EXPECT_EQ(0, remove(tmp_fname.c_str())); fails
probably imread function did not release file handle

[ RUN      ] Imgcodecs_JpegXL_MatType.write_read/0, where GetParam() = (8UC1, 0)
C:\projects\opencv\modules\imgcodecs\test\test_jpegxl.cpp(57): error: Expected equality of these values:
  0
  remove(tmp_fname.c_str())
    Which is: -1
[  FAILED  ] Imgcodecs_JpegXL_MatType.write_read/0, where GetParam() = (8UC1, 0) (53 ms)
    string tmp_fname = cv::tempfile(".jxl");
    Mat img_org(320, 480, matType, col);
    vector<int> param;
    param.push_back(IMWRITE_JPEGXL_DISTANCE);
    param.push_back(distanceParam);
    EXPECT_NO_THROW(ret = imwrite(tmp_fname, img_org, param));
    EXPECT_TRUE(ret);
    Mat img_decoded;
    EXPECT_NO_THROW(img_decoded = imread(tmp_fname, IMREAD_UNCHANGED));
    EXPECT_FALSE(img_decoded.empty());

    EXPECT_LE(cvtest::norm(img_org, img_decoded, NORM_INF), th);

    EXPECT_EQ(0, remove(tmp_fname.c_str()));

Steps to reproduce

compile OpenCV with newly added JpegXL support
run opencv_test_imgcodecs

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions