Fannovel16 / comfyui_controlnet_aux

ComfyUI's ControlNet Auxiliary Preprocessors
Apache License 2.0
1.91k stars 180 forks source link

cv2 has no attribute 'resize' #301

Open AndreBuzz opened 4 months ago

AndreBuzz commented 4 months ago

Using the node AIO Aux Preprocessor it present me an error message that i attach below. I tried reinstall opencv and other libraries that had conflicted version, but the problem persists. I tried looking on forums but no solution proved useful. I'm thankful to anyone willing to help or point to a solution.

Error occurred when executing AIO_Preprocessor:

module 'cv2' has no attribute 'resize'

File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-0246\utils.py", line 381, in new_func
res_value = old_func(*final_args, **kwargs)
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\__init__.py", line 113, in execute
return getattr(aux_class(), aux_class.FUNCTION)(**params)
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\node_wrappers\canny.py", line 20, in execute
return (common_annotator_call(CannyDetector(), image, low_threshold=low_threshold, high_threshold=high_threshold, resolution=resolution), )
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\utils.py", line 82, in common_annotator_call
np_result = model(np_image, output_type="np", detect_resolution=detect_resolution, **kwargs)
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\canny\__init__.py", line 10, in __call__
detected_map, remove_pad = resize_image_with_pad(input_image, detect_resolution, upscale_method)
File "J:\AI\ComfyUI_windows_portable_nvidia_cu118_or_cpu\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfyui_controlnet_aux\src\controlnet_aux\util.py", line 153, in resize_image_with_pad
img = cv2.resize(img, (W_target, H_target), interpolation=get_upscale_method(upscale_method) if k > 1 else cv2.INTER_AREA)
Ni-Zhann commented 4 months ago

same issue here

echofire26 commented 3 months ago

I had a similar issue - I'm running off a linux server - so can't speak to windows - but I had an issue with ComfyUI Impact Pack while digging into the issue I noticed. I then fixed permissions on the local folder for my install. After fixing that, uninstalling ComfyUI Impact Pack, restarting, reinstalling ComfyUI Impact Pack - I'm no longer getting the issue.... so either it was related to that pack -- or the permissions -- not entirely sure.

Sorry if this isn't too helpful - but maybe this helps.