Skip to content

Should CV_16F be supported? #20279

@mauler2025

Description

@mauler2025
#include <opencv2/opencv.hpp>
using namespace cv;

int main()
{    
    Mat mat = Mat::zeros(3, 3, CV_16F); // But it is just fine for CV_32F, weird?
    FileStorage fs("file.yml", FileStorage::WRITE);
    fs << "Mat" << mat;
    fs.release();
    return 0;
}

OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.5.1) Error: Assertion failed (depth >=0 && depth <= CV_64F)
in typeSymbol, file C:\opencv-4.5.1\modules\core\src\persistence.cpp,
line 146

Taken from the interface.h

#define CV_8U   0
#define CV_8S   1
#define CV_16U  2
#define CV_16S  3
#define CV_32S  4
#define CV_32F  5
#define CV_64F  6
#define CV_16F  7

and the line 146 which is

CV_Assert(depth >=0 && depth <= CV_64F);

CV_16F is not supported. Should it be supported?


relates #12463

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions