gaussian-splatting icon indicating copy to clipboard operation
gaussian-splatting copied to clipboard

cv2.error: Assertion failed) dst.cols < SHRT_MAX && dst.rows...

Open goometasoft opened this issue 1 year ago • 1 comments

windows-11 , cuda-12.1 , pytorch-2.2

cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\imgwarp.cpp:1744: 
error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && 
src.rows < SHRT_MAX in function 'cv::remap'

----------------------------------------------------
python utils/make_depth_scale.py ^
More? --base_dir   E:\AI\test\horns-62\A3V ^
More? --depths_dir E:\AI\test\horns-62\A3V\depths

joblib.externals.loky.process_executor._RemoteTraceback:
"""
Traceback (most recent call last):
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\_parallel_backends.py", line 273, in _wrap_func_call
    return func()
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 589, in __call__
    return [func(*args, **kwargs)
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 589, in <listcomp>
    return [func(*args, **kwargs)
  File "E:\AI\A3V\240826\win_121\utils\make_depth_scale.py", line 51, in get_scales
    invmonodepth = cv2.remap(invmonodepthmap, maps[..., 0], maps[..., 1], interpolation=cv2.INTER_LINEAR, borderMode=cv2.BORDER_REPLICATE)[..., 0]

cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\imgwarp.cpp:1744: 
error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && 
src.rows < SHRT_MAX in function 'cv::remap'

"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "E:\AI\A3V\240826\win_121\utils\make_depth_scale.py", line 81, in <module>
    depth_param_list = Parallel(n_jobs=-1, backend="threading")(
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 1952, in __call__
    return output if self.return_generator else list(output)
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 1595, in _get_outputs
    yield from self._retrieve()
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 1699, in _retrieve
    self._raise_error_fast()
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 1734, in _raise_error_fast
    error_job.get_result(self.timeout)
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 736, in get_result
    return self._return_or_raise()
  File "D:\conda\envs\cuda121\lib\site-packages\joblib\parallel.py", line 754, in _return_or_raise
    raise self._result
	
cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\imgwarp.cpp:1744: 
error: (-215:Assertion failed) dst.cols < SHRT_MAX && dst.rows < SHRT_MAX && src.cols < SHRT_MAX && 
src.rows < SHRT_MAX in function 'cv::remap'

goometasoft avatar Aug 28 '24 07:08 goometasoft

My guess:

OpenCV fails to load images whose pixel resolution is more than signed int16_t.

For example, I get a similar assertion failure when running OpenCV's remap on a JPG of size 34142 x 17071.

This is documented on:

https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html#gab75ef31ce5cdfb5c44b6da5f3b908ea4

Due to current implementation limitations the size of an input and output images should be less than 32767x32767.

nh2 avatar Mar 10 '25 14:03 nh2