I'm trying to compute the FFT (Fast Fourier Transform) of an image to use the frequencies to determine whether or not the image is blurry.
I need to use a custom FFT algorithm that we already have in our codebase. The FFT algorithm requires a standard 1D vector of doubles
or ints
. I need a way to read in an image and then convert it to a vector of doubles so that I can compute the FFT of the image.
I have tried the following:
cv::Mat inputImage = cv::imread("testImage.png");
cv::Mat fImage;
inputImage.convertTo(fImage, CV_32F);
std::vector<double> actualImage = fImage.clone();
However, I am getting the error:
OpenCV Error: Assertion failed (channels() == CV_MAT_CN(dtype)) in copyTo,
Any ideas to how I can achieve this?