Slope from 3D intensity plot

2 次查看(过去 30 天)
D Kemper
D Kemper 2018-8-10
Hi,
I have an intensity plot versus height and time. As shown in the figure, the slope is clearly visible by eye. But I have trouble detecting it by code. Finding the minimum for each row does not work since each row contains multiple minima and also not in the region of interest.
Any suggestions on how to tackle this? Any help is appreciated.
Thanks.
Code used:
%%%Camera parameters
fps = 60; % Frames per second
dt = 1/60; % Time step (in this case 1/fps)
dx = 1; % Spatial resolution per pixel
%%%Path of avi file
path = '10/PIV_10_2.avi';
%%%Read video object
vidObj = VideoReader(path);
%%%Get video properties
nFrames = vidObj.NumberOfFrames; % Number of frames in video
vidHeight = vidObj.Height; % Height of frame
vidWidth = vidObj.Width; % Width of frame
%%%Get positions for window
frame = read(vidObj, round(nFrames/4)); % Read frame at 1/4th of the total time
imshow(frame) % Show frame
[x,~] = ginput(2); % Get positions from click
close all
x = round(x); % Whole pixel
%%%Get intensity profile per frame
intensity_perFrame = zeros(nFrames,vidHeight); % Allocate memory
for i = 1: nFrames
frame = read(vidObj,i); % Read separate frame
window = frame(1:vidWidth,x(1):x(2)); % Create window
intensity_perFrame(i,:) = sum(window,2); % Sum every row intensity
end
%%Plot intensity profile
t = (0:1:(nFrames-1)) *dt; % Time
h = (0:1:(vidHeight-1)) *dx; % Height
[H,T] = meshgrid(h,t); % Create meshgrid for surface plot
surf(T,H,intensity_perFrame) % Surface plot
shading interp % No grid lines
view(0,90) % View from top
xlabel('Time')
ylabel('Height')
zlabel('Intensity')

回答(0 个)

产品


版本

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by