!_map1.empty() in function 'cv::remap'
Question:
I am trying to build this stereo vision obstacle distance detection system using a tutorial, but keep hitting a brick wall and could use some advice, please.
When running either disparity2depth or obstacle_avoidance files, I get the same xml file read errors and remap error at both rectification lines.
[error:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\core\src\persistence.cpp (505) cv::FileStorage::Impl::open Can't open file: '../data/stereo_rectify_maps
.xml' in read mode
[error:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\core\src\persistence.cpp (505) cv::FileStorage::Impl::open Can't open file: '../data/depth_estimation_pa
rams_py.xml' in read mode
Traceback (most recent call last):
File "C:\Users\XXXXXXXXXX\ObstacleAvoidSystem\Depth-Perception-Using-Stereo-Camera\disparity2depth_calib.py", line 84, in <module>
Left_nice= cv2.remap(imgL_gray,
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\imgwarp.cpp:1703: error: (-215:Assertion failed) !_map1.empty() in function 'cv::remap'
Different cv2.FileStorage.open
(filename, flags) have been tried but return similar errors.
Opening in write mode also returned similar errors (as above).
I also tried the full directory path by researching similar (indirect) errors, for example this one and got the following error:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape
Any suggestions would be greatly appreciated!
Answers:
The issue was with the CWD.
assert os.path.exists("data/stereo_rectify_maps.xml"), os.getcwd()
Solved the issue. At first the statement passed/returned nothing, which made me think the file might be corrupted. However, after reloading the IDE and running again, the statement returned the path it was looking for.
I am trying to build this stereo vision obstacle distance detection system using a tutorial, but keep hitting a brick wall and could use some advice, please.
When running either disparity2depth or obstacle_avoidance files, I get the same xml file read errors and remap error at both rectification lines.
[error:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\core\src\persistence.cpp (505) cv::FileStorage::Impl::open Can't open file: '../data/stereo_rectify_maps
.xml' in read mode
[error:[email protected]] global D:\a\opencv-python\opencv-python\opencv\modules\core\src\persistence.cpp (505) cv::FileStorage::Impl::open Can't open file: '../data/depth_estimation_pa
rams_py.xml' in read mode
Traceback (most recent call last):
File "C:\Users\XXXXXXXXXX\ObstacleAvoidSystem\Depth-Perception-Using-Stereo-Camera\disparity2depth_calib.py", line 84, in <module>
Left_nice= cv2.remap(imgL_gray,
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\imgwarp.cpp:1703: error: (-215:Assertion failed) !_map1.empty() in function 'cv::remap'
Different cv2.FileStorage.open
(filename, flags) have been tried but return similar errors.
Opening in write mode also returned similar errors (as above).
I also tried the full directory path by researching similar (indirect) errors, for example this one and got the following error:
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated UXXXXXXXX escape
Any suggestions would be greatly appreciated!
The issue was with the CWD.
assert os.path.exists("data/stereo_rectify_maps.xml"), os.getcwd()
Solved the issue. At first the statement passed/returned nothing, which made me think the file might be corrupted. However, after reloading the IDE and running again, the statement returned the path it was looking for.