I'm not sure I .convertTo()can handle the case of an identical source and destination. You can try to use a couple of temporary variables to get around the error message. Here is the relevant part from your example:
for (k = 0; k < planes.size(); k++) {
Mat planes_k, outplanes_k;
planes[k].convertTo(planes_k, CV_32FC1);
dct(planes_k, outplanes_k);
outplanes_k.convertTo(outplanes[k], CV_8UC1);
}
UPDATE
According to the source code,.convertTo() my suggestion is really not required (thanks, pointing it out, @ boaz001).
source
share