功率谱如图:
(C++实现)
(MATLAB实现)
代码:
C++:
#include<opencv2\core.hpp>
#include<opencv2\imgproc.hpp>
#include<opencv2\imgcodecs.hpp>
#include<opencv2\highgui.hpp>
#include<iostream>
using namespace cv;
using namespace std;
void ShiftDFT(Mat img);
int main(int argc, char ** argv)
{
Mat I = imread("Lena.jpg");
if (I.empty())
{
cout << "Error opening image" << endl;