June 2018
Intermediate to advanced
436 pages
10h 33m
English
Now that we know some properties of the clip, we can start generating the frames to be passed to the Tiny YOLO pre-trained model. First, let's look at a less important but transparent approach:
private volatile Mat[] v = new Mat[1];
private String windowName = "Object Detection from Video";
try {
for(int i = 1; i < frameGrabber.getLengthInFrames();
i+ = (int)frameRate) {
frameGrabber.setFrameNumber(i);
frame = frameGrabber.grab();
v[0] = new OpenCVFrameConverter.ToMat().convert(frame);
model.markObjectWithBoundingBox(v[0], frame.imageWidth, frame.imageHeight, true, windowName);
imshow(windowName, v[0]);
char key = (char) waitKey(20);
// Exit on escape:
if (key == 27) { destroyAllWindows(); ...