Borrar filtros
Borrar filtros

how step method performs different functions at different time

1 visualización (últimos 30 días)
Neelum Dave
Neelum Dave el 26 de En. de 2016
Respondida: Walter Roberson el 26 de En. de 2016
videoFileReader = vision.VideoFileReader('h1.avi');
videoFrame = step(videoFileReader);
figure, imshow(videoFrame)
faceDetector = vision.CascadeObjectDetector;
bbox = step(faceDetector, videoFrame);

Respuestas (1)

Walter Roberson
Walter Roberson el 26 de En. de 2016
So far, Mathworks has avoided using step() as the name of any toolbox routine. However, it is used as the name of a method in a number of different locations, so you have to look at the object type of what you are calling step() on to determine what effect it has.
In the first case, step is being called with videoFileReader, which has been assigned by a call further up as the output from vision.VideoFileReader . The output of that call is a "VideoFileReader System Object".
In the second case, step is being called with faceDetector which has been assigned the output of vision.CascadeObjectDetector which returns a "CascadeObjectDetector System object".
step() is not one specific routine. Object-oriented programming works by "objects" (such as a VideoFileReader System Object) knowing their own "step" routine .
It is sort of like faceDetector was returned as a struct that had a field named 'step', and that the syntax step(faceDetector) was interpreted as meaning the same thing as faceDetector.step(faceDetector) -- that is, calling a function stored with the faceDetector variable. This is not exactly how it is implemented but it is not all that far off.


Más información sobre Tracking and Motion Estimation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by