Skip to content

Mismatch between code and documentation in anisotropicDifussion funciton #1970

@mechatron1991

Description

@mechatron1991
System information (version)
  • OpenCV => 4.0.0
  • Operating System / Platform => Debian on Windows 10(WSL)
  • Compiler => python3 interpreter
Detailed description

Hi,

There appears to be mismatch between the official documentation here and the anisotropicDiffusion function defined here. The document mentions that source image should be grayscale but the assert statement in line 251 checks if the source image has 3 channels.

Steps to reproduce

import cv2
image = cv2.imread('image.png')
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
filtered_image = cv2.ximgprox.anisotropicDiffusion(grascale, 0.25, 10, 1000)

I get the following error:
cv2.error: OpenCV(4.0.0) /io/opencv_contrib/modules/ximgproc/src/anisodiff.cpp:251: error: (-215:Assertion failed) src_.dims() == 2 && type == CV_8UC3 in function 'anisotropicDiffusion'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions