diff --git a/demo/demo/demoDepth.cpp b/demo/demo/demoDepth.cpp index eda04c6..41f5dbf 100644 --- a/demo/demo/demoDepth.cpp +++ b/demo/demo/demoDepth.cpp @@ -55,9 +55,9 @@ int main(int argc, char *argv[]) { cv::VideoWriter resultVideo; if(save) { - int w = cap.get(cv::CAP_PROP_FRAME_WIDTH); - int h = cap.get(cv::CAP_PROP_FRAME_HEIGHT); - resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','P','4','V'), 30, cv::Size(w, h)); + int w = depthNN.output_w; + int h = depthNN.output_h; + resultVideo.open("result.mp4", cv::VideoWriter::fourcc('M','J','P','G'), 30, cv::Size(w, h)); } if(show) @@ -87,6 +87,9 @@ int main(int argc, char *argv[]) { cv::waitKey(1); } + + if(save) + resultVideo << depthNN.depthMats[0]; } std::cout<<"detection end\n"; diff --git a/include/tkDNN/DepthNN.h b/include/tkDNN/DepthNN.h index 0d89ac0..4d34239 100644 --- a/include/tkDNN/DepthNN.h +++ b/include/tkDNN/DepthNN.h @@ -30,6 +30,9 @@ class DepthNN { dnnType *input_d; float* depth_h; + int output_w; + int output_h; + int nBatches = 1; cv::Mat bgr[3]; @@ -68,6 +71,9 @@ class DepthNN { depths[i].resize(netRT->buffersDIM[1].tot()); depth_h = (float *)malloc(netRT->buffersDIM[1].tot() * sizeof(float)); + + output_h = netRT->buffersDIM[1].h; + output_w = netRT->buffersDIM[1].w; } diff --git a/tests/monodepth2/monodepth2.cpp b/tests/monodepth2/monodepth2.cpp index 4e0767a..8618539 100644 --- a/tests/monodepth2/monodepth2.cpp +++ b/tests/monodepth2/monodepth2.cpp @@ -66,11 +66,13 @@ const char* output_bin[] = { "monodepth2/debug/outputs/output-disp-3.bin" }; -const char* input_monodepth2_bin[] = {"monodepth2/debug/input.bin","monodepth2/debug/input2.bin"}; +const char* input_bin = "monodepth2/debug/input.bin"; int main(){ + downloadWeightsifDoNotExist(input_bin, "monodepth2", "https://cloud.hipert.unimore.it/s/iYw9QwgP6CsqxLR/download"); + tk::dnn::dataDim_t dim(1,3,192,640,1); tk::dnn::Network net(dim); @@ -204,7 +206,7 @@ int main(){ dnnType *data; dnnType *input_H; - readBinaryFile(input_monodepth2_bin[0],dim.tot(),&input_H,&data); + readBinaryFile(input_bin, dim.tot(),&input_H,&data); std::cout<<"INPUT DIMENSIONS : "<