How to use blobFromImagesWithParams

blob shape is 333 x 224 x 224 x 3
my image is 500 x 800 x 3

I expect my blobshape is 1 x 224 x 224 x 3
Inference is too long of course forward there is 333 inference

this is working

    int sz[] = { 1,224,224, 3 }
    img.convertTo(imgf, CV_32F);
    imgf = (imgf - 128) / 128;
    Mat blob(4, sz,  CV_32F, imgf.ptr(0));
    my_net.setInput(blob);
    if (my_net.empty())
        cout << "Oops";
    Mat my_ouput1 = my_net.forward(), imgOut1;

and blobshape is 1 x 224 x 224 x 3

1 Like