class_docstr: Use the farnebeck algorithm for the flow-based motion estimator
class_docstr_tok: ["Use","the","farnebeck","algorithm","for","the","flow-based","motion","estimator"]
code: def prepare_frame(self, frame):
      img_h, img_w, _ = frame.shape
      ratio = min(self.flow_scale / img_w, self.flow_scale / img_h)
      flow_h, flow_w = int(img_h * ratio), int(img_w * ratio)
      cv2 = self._cv2
      resized_gray_frame = cv2.cvtColor(
          cv2.resize(
              frame, (flow_w, flow_h), interpolation=cv2.INTER_NEAREST
          ),
          cv2.COLOR_BGR2GRAY,
      )
      return resized_gray_frame
  
imports: import time
  import logging
  from abc import ABC, abstractmethod
  import numpy
label_desc: Use image node_id 2 for calling the FarneBeckFlowMotionEstimator obj's underlying member method code with example usage: obj.prepare_frame(frame) and returns: resized_gray_frame