If you need caffe or darknet in opencv 5 you can copy this repo and move it in opencv_contrib before running cmake
and if you need to use an onnx model with dynamic input you can use dnnlegacy::importOnnxWithFixedShape function
paper GitHub - xavysp/DexiNed: DexiNed: Dense EXtreme Inception Network for Edge Detection
model https://storage.googleapis.com/ailia-models/dexined/model.onnx
function dnnlegacy::importOnnxWithFixedShape repalce w and h by 640 and 480
std::map<std::string, int> val;
val["w"] = 640;
val["h"] = 480;
cv::dnn::Net x = dnnlegacy::importOnnxWithFixedShape("dexined.onnx", val);
Mat img = imread(samples::findFile("butterfly.jpg"));
Image2BlobParams paramBlob;
paramBlob.datalayout = DNN_LAYOUT_NCHW;
paramBlob.ddepth = CV_32F;
paramBlob.mean = Scalar(0, 0, 0, 0);
paramBlob.scalefactor = Scalar(1, 1, 1, 1);
paramBlob.size = Size(640, 480);
paramBlob.swapRB = false;
paramBlob.paddingmode = DNN_PMODE_NULL;
Mat blobNHWC = blobFromImageWithParams(img, paramBlob);
x.setInput(blobNHWC);
Mat y = x.forward("block_cat");