- Video file must have at least 75 frames, ie the sequence must have at least 75 images.
- The image sequence must be 3 dimensional. I am assuming you mean each image is 2 dimensional and each image in the sequence is stacked on top of each other to make the sequence 3 dimensional. Hence the third dimension (or depth) of the sequence is equal to the number of frames in sequences
How to use arguments validation functions for multi-frame images?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi, I am designing a function to analyse an image sequence frame by frame to return a vector of time according to the cardiac cycle. For the image file argument validation, how do I customise a validation function for these two purposes:
1) ensure each sequence have a reasonable duration (number of frames, minimum 75 frames in total) 2) must be a 3D array
Thanks in advance!
function peaktimes = detectCardiacPhase(img, frameRate)
arguments
img (:,:,:) {mustBeNumeric}
frameRate double {mustBePositive} = 15 %default value of frameRate is 15 frames/sec
end
end
댓글 수: 0
채택된 답변
Ashutosh
2023년 6월 8일
From what I am understanding, you need your function to perform 2 preliminary checks on any input video (or in other words, image sequence) file:
I will admit I am not entirely sure I got these right, so let me know if something is amiss.
You can check the 2 conditions as follows:
function peaktimes = detectCardiacPhase(img, frameRate)
errorMsg1 = "The entered sequence is not 3D";
errorMsg2 = "The entered sequence is too short";
if length(size(img)) ~= 3 % check if input is 3D
error(errorMsg1);
elseif size(img,3) < 75 % check if there are at least 75 frames
error(errorMsg2);
end
% main
% function
end
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!