- Read the video file and convert the frames into a grayscale.
- Apply Hilbert transform using the ‘hilbert’ function in MATLAB.
- Calculate the phase angle in MATLAB using the ‘angle’ function
- Find out the difference between the two phases.
Computing change in phase of a signal using hilbert transform
31 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Balaji
on 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:
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
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!