Computing change in phase of a signal using hilbert transform

35 vues (au cours des 30 derniers jours)
Anisia Anil
Anisia Anil le 14 Sep 2023
Réponse apportée : Balaji le 22 Sep 2023
How do I compute the change in phase of a signal using hilbert transform? My input signal is a video, so i want to compute the phase change from frame to frame.

Réponses (1)

Balaji
Balaji le 22 Sep 2023
Hi Anisia
I Understand that you want to find the phase shift in the of the Hilbert transform of an input video.
For that I suggest you do the following steps:
  1. Read the video file and convert the frames into a grayscale.
  2. Apply Hilbert transform using the ‘hilbert’ function in MATLAB.
  3. Calculate the phase angle in MATLAB using the ‘angle’ function
  4. Find out the difference between the two phases.
Here is a reference code:
% Read the video
video = VideoReader('video.mp4');
%Define two frames to be compared
index1 = 15;
index2 = 20;
%Read the corresponding frames
frame1 = read(video, index1);
frame2 = read(video, index2);
signal1 = rgb2gray(frame1);
signal2 = rgb2gray(frame2);
% Apply the Hilbert transform
analyticSignal1 = hilbert(signal1);
analyticSignal2 = hilbert(signal2);
% Extract the phase angle
phase1 = angle(analyticSignal1);
phase2 = angle(analyticSignal2);
%Calculate the phase difference
phaseDifference = phase1 - phase2;
I suggest you refer the following documentation for more information:
Hope this helps!
Thanks
Balaji

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by