mindx sdk如何实现存储视频流的某一帧?
收藏回复举报
mindx sdk如何实现存储视频流的某一帧?
t('forum.solved') 已解决
发表于2023-09-28 10:58:01
0 查看

我在基于【SDK案例系列 10】基于 Live555 + MindX SDK + Pytorch YoLoV5的视频检测 https://blog.csdn.net/hiascend/article/details/128588487?spm=1001.2014.3001.5502

修改了pipeline同时拿到序列化数据以及检测的视频,但是我想获取某一帧的图片该如何实现?

pipeline如下:

    "classification": { 

        "stream_config": { 

            "deviceId": "0" 

        }, 

        "mxpi_rtspsrc0": { 

            "factory": "mxpi_rtspsrc", 

            "props": { 

                "rtspUrl": "rtsp://127.0.0.1:8554/zhanyong", 

                "channelId": "0" 

            }, 

            "next": "mxpi_videodecoder0" 

        }, 

        "mxpi_videodecoder0": { 

            "factory": "mxpi_videodecoder", 

            "props": { 

                "inputVideoFormat": "H264", 

                "outputImageFormat": "YUV420SP_NV12", 

                "vdecChannelId": "0" 

            }, 

            "next": "tee0" 

        }, 

        "tee0": { 

            "factory": "tee", 

            "next": [ 

                "queue1", 

                "queue2" 

            ] 

        }, 

        "queue1": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "mxpi_imageresize0" 

        }, 

        "queue2": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "mxpi_opencvosd_plugin:0" 

        }, 

        "mxpi_imageresize0": { 

            "props": { 

                "dataSource": "mxpi_videodecoder0", 

                "resizeHeight": "640", 

                "resizeWidth": "640", 

                "resizeType": "Resizer_KeepAspectRatio_Fit" 

            }, 

            "factory": "mxpi_imageresize", 

            "next": "queue3" 

        }, 

        "queue3": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "mxpi_modelinfer0" 

        }, 

        "mxpi_modelinfer0": { 

            "props": { 

                "dataSource": "mxpi_imageresize0", 

                "modelPath": "data/models/yolov5/yolov5l.om", 

                "postProcessConfigPath": "data/models/yolov5/yolov5.cfg", 

                "labelPath": "data/models/yolov5/coco2014.names", 

                "postProcessLibPath": "libMpYOLOv5PostProcessor.so" 

            }, 

            "factory": "mxpi_modelinfer", 

            "next": "queue4" 

        }, 

        "queue4": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "tee1" 

        }, 

         "tee1": { 

            "factory": "tee", 

            "next": ["mxpi_dataserialize0","mxpi_object2osdinstances0"] 

        }, 

         "mxpi_dataserialize0": { 

      "props": { 

        "outputDataKeys": "mxpi_modelinfer0" 

      }, 

      "factory": "mxpi_dataserialize", 

      "next": "appsink1" 

    }, 

        "mxpi_object2osdinstances0": { 

            "props": { 

                "dataSource": "mxpi_modelinfer0", 

                "colorMap":"100,100,100|200,200,200|0,128,255|255,128,0", 

                "fontFace":"16", 

                "fontScale":"0.5", 

                "fontThickness":"2", 

                "fontLineType":"16", 

                "rectThickness":"2", 

                "rectLineType":"16" 

            }, 

            "factory":"mxpi_object2osdinstances", 

            "next": "queue5" 

        }, 

        "queue5": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "mxpi_opencvosd_plugin:1" 

        }, 

        "mxpi_opencvosd_plugin":{ 

            "factory":"mxpi_opencvosd", 

            "next":"queue6" 

        }, 

        "queue6": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "mxpi_videoencoder0" 

        }, 

        "mxpi_videoencoder0": { 

            "props": { 

                "imageHeight": "1080", 

                "imageWidth": "1920", 

                "inputFormat": "YUV420SP_NV12", 

                "outputFormat": "H264", 

                "fps": "1", 

                "maxBitRate":"20000", 

                "iFrameInterval": "50" 

            }, 

            "factory": "mxpi_videoencoder", 

            "next": "queue7" 

        }, 

        "queue7": { 

            "props": { 

                "max-size-buffers": "100" 

            }, 

            "factory": "queue", 

            "next": "appsink0" 

        }, 

        "appsink0": { 

            "factory": "appsink" 

        }, 

           "appsink1": { 

            "factory": "appsink" 

        } 

    } 

}

这种方式存储的图片显示格式有问题,请问有大佬帮忙解决吗

我要发帖子