Fix saving result video in demoDepth, add automatic download for monodepth2 weights
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 : "<<dim.tot()<<std::endl;
|
||||
|
||||
net.print();
|
||||
|
||||
Reference in New Issue
Block a user