[英]How to generate a specific synthetic image
我想生成一個 64x64 像素的黑色圖像,中間有一個 5x10 像素的白色矩形,然后使用 2D 傅立葉變換來繪制原始圖像、模塊、相位和恢復圖像。
這是我的代碼:
image_1_black = double(zeros(64, 64, 3, 'uint8'));
image_1_white = double(ones(5, 10, 3, 'uint8'));
% I need to do something like this:
% image1 = image_1_black with image_1_white
IMAGE_1 = fft2(image_1);
IMAGE_1 = fftshift(IMAGE_1);
IMAGE_1_REC = fftshift(IMAGE_1);
image_1_rec = ifft2(IMAGE_1_REC);
figure;
subplot(2, 2, 1);
imagesc(image_1);
colormap(gray);
axis off;
title('Original image');
subplot(2, 2, 2);
imagesc(100*log(1 + abs(IMAGE_1)));
colormap(gray);
axis off;
title('Magnitude spectrum');
subplot(2, 2, 3);
imagesc(angle(IMAGE_1));
colormap(gray);
axis off;
title('Phase spectrum');
subplot(2, 2, 4);
imagesc(image_1_rec);
colormap(gray);
axis off;
title('Imagen recuperada');
我知道如何單獨生成兩個圖像,但不知道如何將它們組合起來以在我的代碼正常工作的情況下獲得所需的圖像。
謝謝你們!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.