How do i loop this fuction and each time use a different AVI for processing
이전 댓글 표시
Hi, I made a Function that will get an AVI and remove the background by using Z-stack so the image is easier to track the moving objects. But i want to do this for a series of AVI files but i'm not sure where to start. I know i should use loop but i don't know how to input the location of the AVIs per loop. Basically i want the fuction to get say an AVI-1 and process it then process AVI-2, then AVI-3, etc. The Bold is the Function and the Italic is the description:
- Vid1 = VideoReader('Moviessmall.avi') %# Allow MATLAB to recognize the file by using VideoReader
- Vid1Frames = read(Vid1) %# RECOGNIZING the Frames in the movie
- Vid2Frames = rgb2gray(Vid1Frames); %# Change the movie to a GRAY SCALE movie. limiting the movie to 3 arrays
- Vid3Frames = Vid1Frames(:,:,1:450); %# Stacks Z-PROJECT
- VidB = median(Vid3Frames, 3); %# Run a MEDIAN to get a background image
- VidB2 = repmat(VidB, [1 1 450]); %# Because images need to be of the same FRAME number to Subtract a Frame duplication with repeat must be done
- Vid2 = Vid3Frames-VidB2; %# The SUBTRACTION to get an array
- Vid2 = Vid3Frames-VidB2; %# The SUBTRACTION to get an array
Thank you, Minh
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!