Thanks to visit codestin.com
Credit goes to github.com

Skip to content

5D blob in opencv : back to c function? #25129

@LaurentBerger

Description

@LaurentBerger

Describe the feature and motivation

I need a 5D blob as model input : tensor: float32[2,1,3,240,320]

I cannot find an opencv function. i wrote :

        Mat img0 = imread("C:/data/kitti/testing/image_2/000198_10.png");
        Mat img1 = imread("C:/data/kitti/testing/image_2/000198_11.png");
        Image2BlobParams param;
        param.datalayout = DNN_LAYOUT_NCHW;
        param.size = Size(320, 240);

        Mat blob0 = blobFromImageWithParams(img0, param);
        Mat blob1 = blobFromImageWithParams(img1, param);
        vector<int> szData = { 2, 1, 3, 240 ,320 };
        Mat blob(szData, CV_32FC1);
        memcpy(blob0.data, blob.data, 3 * 240 * 320 * 4);
        memcpy(blob1.data, blob.data + 3 * 240 * 320 * 4, 3 * 240 * 320 * 4);

May be an opencv function would be usefull.

As a problem never comes alone output result is tensor x: float32[1,2,240,320]
It would be nice to have an opencv function which can extract two images x[0,0] and x[0, 1] (#24173)

Additional context

https://github.com/MasterHow/CSFlow

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