program code is as follows:
// 导入图像
std::stringstream ss;
ss << "/home/wang/桌面/LearningVO-master/build/dataset/00/image_0/"
<< std::setw(6) << std::setfill('0') << img_id << ".png";
cv::Mat img(cv::imread(ss.str().c_str(), 0));
assert(!img.empty());
picture path is as follows:
but the program will assert failed.
my solution:
OpenCV absolute path seems to be a problem, change the absolute path to relative path:
// 导入图像
std::stringstream ss;
ss << "./dataset/00/image_0/"
<< std::setw(6) << std::setfill('0') << img_id << ".png";
cv::Mat img(cv::imread(ss.str().c_str(), 0));
assert(!img.empty());
note that this relative path is relative to the path to execute the command in the terminal; Also write “/Home/ XXX/” instead of” ~/ XXX/” in the Home directory, otherwise an error will occur.
modified, the program runs normally.
p>
Read More:
- AttributeError: ‘NoneType‘ object has no attribute ‘shape‘
- No such file or directory
- error: (-215:Assertion failed) !ssize.empty() in function ‘resize‘
- Ccache: failed to create / home
- Vs Code Python relative path error
- Format control of cout cout.width () and cout.fill ()
- Environment configuration at the beginning of OpenCV + vs2015
- Relative path and absolute path${ pageContext.request.contextPath }
- Tensorflow error record: depreciation warning: elementwise
- HYDU_ create_ Process (. /utils/launch/launch.c:69): execvp error on file.. Error handling
- How to generate and view SSH keys in Ubuntu 16.04
- Command not found: ADB appears on Mac
- Python SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3:
- dd make start up usb
- Raspberry pie startup self startup opencv program script and error analysis
- Solve the problem of pychar import error
- Virtual environment: error: virtualenv is not compatible with this system or executable
- Change the path in the user directory in Chinese Ubuntu to English
- Error reported when debugging Hadoop cluster under windows failed to find winutils.exe