0

我想在我的编码中创建一个掩码,我有一个 Rect 和一个输入图像,那么如何初始化掩码。

4

1 回答 1

1

掩码通常是 CV_8U Mat。

  1. 生成一个 CV_8U Mat
  2. 在这张垫子上画画

这对我有用:

Mat mask = new Mat(src.size(), CvType.CV_8U, new Scalar(0)); // This will contain the mask

Imgproc.rectangle(mask, point1, point2, new Scalar(1), Core.FILLED); // Draw on the mask

我希望它可以帮助你:)

于 2015-06-05T16:25:21.470 回答