Problem in converting mp4 video frames to kv log

Hi, I am a beginner and trying to convert a mp4 video to kv logging format for free space segmentation. here is part of my code after referring to Converting video frames in proto

Test_conver.cpp:
void Test_convert::tick() {
cap.read(image_);
if (image_.empty()){
LOG_INFO(“Done recording”);
return;
}
auto output = tx_video_frames().initProto();
output.setCols(image_.cols);
output.setRows(image_.rows);
output.setChannels(3);
isaac::Image3ub output_image(image_.cols,image_.rows);//create a new 3 channels image
cv::Mat image = cv::Mat(image_.rows, image_.cols, CV_8UC3, const_cast<void*>(static_cast<const void*>(output_image.data().pointer())));//point the mat to proto
//modify your cv Mat there
image = image_;
ToProto(std::move(output_image), output, tx_video_frames().buffers());
tx_video_frames().publish();
}

test_convert.app.json:
{
“name”: “test_convert”,
“modules”: [
“//packages/testing/test_convert:test_convert_components”
],
“graph”: {
“nodes”: [
{
“name”: “test_convert”,
“components”: [
{
“name”: “message_ledger”,
“type”: “isaac::alice::MessageLedger”
},
{
“name”: “test_convert”,
“type”: “Test_convert”
}
]
},
{
“name”: “recorder”,
“components”: [
{
“name”: “MessageLedger”,
“type”: “isaac::alice::MessageLedger”
},
{
“name”: “Recorder”,
“type”: “isaac::cask::Recorder”
}
]
}
],
“edges”: [
{
“source”: “test_convert/test_convert/video_frames”,
“target”: “recorder/Recorder/video_frames”
}
]
},
“config”: {
“test_convert” : {
“test_convert” : {
“tick_period” : “30ms”
}
}
},
“recorder”: {
“Recorder”: {
“base_directory”: “/home/user/workspace/nvidia_isaac/sdk/apps/my_package/”,

      "start_recording_automatically": false
    }
  }

}

and I got:
ERROR external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@295: packages/testing/test_convert/libtest_convert_components_module.so: …/test_convert/libtest_convert_components_module.so: undefined symbol: _ZN2cv6String8allocateEm
2021-09-03 10:57:29.274 PANIC external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@297: Could not load all required modules for application.

After that, I try to include //third_party:opencv into the BUILD:
load(“//bzl:module.bzl”, “isaac_app”, “isaac_cc_module”)
isaac_cc_module(
name = “test_convert_components”,
srcs = [“Test_convert.cpp”],
hdrs = [“Test_convert.hpp”],
visibility = [“//visibility:public”],
deps = [
“//third_party:opencv”,
],
)

isaac_app(
name = “test_convert”,
modules = [“//packages/testing/test_convert:test_convert_components”,
“message_generators”,
“sight”,
“viewers”,],
)
and got:
packages/testing/test_convert/libtest_convert_components_module.so: libopencv_imgcodecs.so.4.1: cannot open shared object file: No such file or directory
2021-09-03 16:57:40.417 PANIC external/com_nvidia_isaac_engine/engine/alice/backend/modules.cpp@297: Could not load all required modules for application

I can run the opencv tutorial so I not quite sure where could be the prob.
Thank you.

OpenCV still seems the likely suspect. The tutorials may not cover the imgcodecs perhaps. Are you sure you are running OpenCV 4 and not 3 by any chance? Can you find this file libopencv_imgcodecs.so.4.1 anywhere on your system? Might be a red herring but still worth double-checking.