code: def render_registration(self):
          '''
          Render pinned points on video frame as red rectangle.
          '''
          surface = self.get_surface()
          if self.canvas is None or self.df_canvas_corners.shape[0] == 0:
              return surface
  
          corners = self.df_canvas_corners.copy()
          corners['w'] = 1
  
          transform = self.canvas.shapes_to_canvas_transform
          canvas_corners = corners.values.dot(transform.T.values).T
  
          points_x = canvas_corners[0]
          points_y = canvas_corners[1]
  
          cairo_context = cairo.Context(surface)
          cairo_context.move_to(points_x[0], points_y[0])
          for x, y in zip(points_x[1:], points_y[1:]):
              cairo_context.line_to(x, y)
          cairo_context.line_to(points_x[0], points_y[0])
          cairo_context.set_source_rgb(1, 0, 0)
          cairo_context.stroke()
          return surfacf render_registration(self):
          '''
          Render pinned points on video frame as red rectangle.
          '''
          surface = self.get_surface()
          if self.canvas is None or self.df_canvas_corners.shape[0] == 0:
              return surface
  
          corners = self.df_canvas_corners.copy()
          corners['w'] = 1
  
          transform = self.canvas.shapes_to_canvas_transform
          canvas_corners = corners.values.dot(transform.T.values).T
  
          points_x = canvas_corners[0]
          points_y = canvas_corners[1]
  
          cairo_context = cairo.Context(surface)
          cairo_context.move_to(points_x[0], points_y[0])
          for x, y in zip(points_x[1:], points_y[1:]):
              cairo_context.line_to(x, y)
          cairo_context.line_to(points_x[0], points_y[0])
          cairo_context.set_source_rgb(1, 0, 0)
          cairo_context.stroke()
          return surface
docs: Render pinned points on video frame as red rectangle.