I have an image

I only got the phase-reconstructed image using the fftn function.
My goal
Using only reconstruction of this image, I get only edges and lines
Then I want to color these lines and edges with red or blue in the phase-reconstructed image only.
Then I want to put this “color” image on the original image so that the edges and lines from the original images can be strongly illuminated with the corresponding red or blue color.
But when I run the code, I get the following error
'Indexes indices must be either natural integers or logical.
Error in sagar_image (line 17) overlay (ph) = 255;
So what should I do?
clc; close all; clear all; img=imread('D:\baby2.jpg'); figure,imshow(img); img=rgb2gray(img); fourier_transform=fftn(img);%take fourier transform of gray scale image phase=exp(1j*angle(fourier_transform)); phase_only=ifftn(phase);%compute phase only reconstruction figure,imshow(phase_only,[]); ph=im2uint8(phase_only);%convert image from double to uint8 superimposing = img; superimposing(ph) = 255; figure, imshow(superimposing,[]),
sagar source share