- This topic has 3 replies, 2 voices, and was last updated 1 year, 8 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forums › Fórum Visão Computacional: O Guia Completo › Erro na linha cv2.imshow(imagem) apos importar …from google.colab.patches impo
DisabledFunctionError Traceback (most recent call last)
<ipython-input-11-86be3400131a> in <cell line: 3>()
1 #cv2.imshow(imagem)
2 from google.colab.patches import cv2_imshow
—-> 3 cv2.imshow(imagem)
/usr/local/lib/python3.10/dist-packages/google/colab/_import_hooks/_cv2.py in wrapped(*args, **kwargs)
46 def wrapped(*args, **kwargs):
47 if not os.environ.get(env_var, False):
—> 48 raise DisabledFunctionError(message, name or func.__name__)
49 return func(*args, **kwargs)
50
DisabledFunctionError: cv2.imshow() is disabled in Colab, because it causes Jupyter sessions
to crash; see https://github.com/jupyter/notebook/issues/3935.
As a substitution, consider using
from google.colab.patches import cv2_imshow
Olá José!
Para resolver esse erro, basta trocar cv2.imshow por cv2_imshow, pois o nome da função de exibição de imagem usada no Colab é cv2_imshow (com “_” e não “.“) . Ou seja, apenas fazendo essa correção no código deve funcionar.
Agradeço Gabriel, me confundi com o comando inserido.
Tópico resolvido.
Disponha! =)