0

I ran the answer from this question Blending does not remove seams in OpenCV but I am getting

OpenCV Error: Unsupported format or combination of formats source image must be 8UC1 and the distance map must be 32fc1 or 8uC1 in case of simple L1 distance transform>> in unknown function.

Why am I getting this error?Does it have to do with my inputs??

Community
  • 1
  • 1
Steph
  • 609
  • 3
  • 13
  • 32

1 Answers1

0

The doc of opencv on the distance tranform states that the input image must be "8-bit, single-channel " (CV_8UC1) and that the output image will be "32-bit floating-point, single-channel" (CV_32FC1) http://docs.opencv.org/modules/imgproc/doc/miscellaneous_transformations.html .

It is likely that your input image is not CV_8UC1. To get one, you may use a comparison operator such as >=, as in the sample code on the distance transform distrans.cpp ( in the source, in opencv/samples/cpp ).

 Mat edge = gray >= edgeThresh;

edge will be the input, gray may be a grayscale image and edgeThresh is an integer (=100).

To get a grayscale image, you may use first : How can I convert a cv::Mat to a gray scale in OpenCv?

 cv::cvtColor(colorMat, gray, CV_BGR2GRAY);

Bye,

Community
  • 1
  • 1
francis
  • 9,525
  • 2
  • 25
  • 41