Skip to content
This repository was archived by the owner on Feb 21, 2021. It is now read-only.
This repository was archived by the owner on Feb 21, 2021. It is now read-only.

Assertion failed (m.dims >= 2) at erode #1

@ghost

Description

Hi,

I was trying to run the code of the grabFrame method from the ObjRecognitionController class but I'm getting an error when I perform the Imgproc.erode operation:

Mat erodeElement = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(12, 12));
Imgproc.erode(mask, morphOutput, erodeElement);

The error is:

OpenCV Error: Assertion failed (m.dims >= 2) in cv::Mat::Mat, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\matrix.cpp, line 454
Exception in thread "main" CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\core\src\matrix.cpp:454: error: (-215) m.dims >= 2 in function cv::Mat::Mat
]
at org.opencv.imgproc.Imgproc.erode_2(Native Method)
at org.opencv.imgproc.Imgproc.erode(Imgproc.java:2007)
at MainMorphological.main(MainMorphological.java:34)

Have you had to deal with this error?do you know what the reason of the error is?

I don't know what the problem is since the mask and morphOutput elements are empty Mats and the erodeElement is exactly the same as the one you're using.

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions