How to use FPS count using streamlit and cv2?

Hey Team!!
I am facing an error while working with my project, here I suppose to count my video fps and accordingly will move further, but I am getting errors related to ["AttributeError: ‘numpy. ndarray’ object has no attribute “get” "].Is there any further way to deal with this ndarray problem.

import cv2
from streamlit_webrtc import VideoTransformerBase, webrtc_streamer


class VideoTransformer(VideoTransformerBase):
    def transform(self, frame):
        img = frame.to_ndarray(format="bgr24")

        img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

        image_hight, image_width, _ = img.shape
        fps = img.get(cv2.CAP_PROP_FPS)

        print("===================",fps)

        return img


webrtc_streamer(key="example", video_transformer_factory=VideoTransformer)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.