A Guru Schema is a Javascript class that allows you to tell the Guru AI platform how to process your video. Once you write a Guru Schema, you can run the same schema in the cloud and on mobile.

You can create a new Guru Schema from the Guru Console. We recommend starting from a template to get up and running faster.

Overview

The class holds three Javascript functions that each handle a separate component of AI video analysis:

export default class GuruSchema {
  /**
   * Defines what AI operations should be carried out on each frame.
   * @param frame - The current video frame to be processed.
   * @returns The results of the AI operations.
   */
  async processFrame(frame) {
    return this.outputs();
  }

  /**
   * Defines what visual rendering should be done on each frame of the video.
   * It can be used to visualize the output of Guru's AI platform. (optional)
   * @param frameCanvas - The canvas element where the frame should be rendered.
   */
  renderFrame(frameCanvas) {
  }

  /**
   * Process the output of the schema on all video frames seen so far, such as counting the number of repetitions of a movement.
   * @returns An object with the processed outputs.
   */
  async outputs() {
    return {};
  }
}

For example, Guru will call your processFrame function for individual frames within the video. It will then call your renderFrame for each frame, so that you can visualize the output of processFrame. The response from outputs will be returned to your application as the final analysis for the video.

Reference

You can dive deeper in our Guru Schema Reference or go through an example.