ShootingStarDragon / 213d

1 stars 1 forks source link

organize the inputs/outputs for users #79

Open ShootingStarDragon opened 1 year ago

ShootingStarDragon commented 1 year ago

so their cv function must accept: shared_metadata_dict["latest_cap_frame"],shared_analysis_dict ,shared_metadata_dict and then must break in the case for things like mediapipe

        with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:
            while True:
                if "kivy_run_state" in shared_metadata_dict.keys(): 
                    if shared_metadata_dict["kivy_run_state"] == False:
                        break

                frame = shared_metadata_dict["latest_cap_frame"]
                # Recolor Feed
                image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
                image.flags.writeable = False #I have read that writable false/true this makes things faster for mediapipe holistic

                # Make Detections
                results = holistic.process(image)

                # Recolor image back to BGR for rendering
                image.flags.writeable = True   
                image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)

                # 2. Right hand
                mp_drawing.draw_landmarks(image, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS, 
                                        mp_drawing.DrawingSpec(color=(80,22,10), thickness=2, circle_radius=4),
                                        mp_drawing.DrawingSpec(color=(80,44,121), thickness=2, circle_radius=2)
                                        )

                # 3. Left Hand
                mp_drawing.draw_landmarks(image, results.left_hand_landmarks, mp_holistic.HAND_CONNECTIONS, 
                                        mp_drawing.DrawingSpec(color=(121,22,76), thickness=2, circle_radius=4),
                                        mp_drawing.DrawingSpec(color=(121,44,250), thickness=2, circle_radius=2)
                                        )

                # 4. Pose Detections6
                mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_holistic.POSE_CONNECTIONS, 
                                        mp_drawing.DrawingSpec(color=(245,117,66), thickness=2, circle_radius=4),
                                        mp_drawing.DrawingSpec(color=(245,66,230), thickness=2, circle_radius=2)
                                        )

                shared_analysis_dict[1] = cv2.flip(image,0)
ShootingStarDragon commented 1 year ago

import FCVA

here i define the cv function, take a frame, return a frame:
@FCVA
def my_cv_function(inputframe):
    return outputframe

if __name__ == 'this filename':
    FCVA.run()
ShootingStarDragon commented 1 year ago
ShootingStarDragon commented 1 year ago

reading list they didn't get into the code details RIP

ShootingStarDragon commented 1 year ago

stuff ppl need to know: they get the frame, both dicts, and need a flag if they're doing an inner while True loop...

ShootingStarDragon commented 1 year ago

shared_metadata_dictVAR["toggleCV"] and what it does (there is a check for open_media and open_appliedcv subprocesses )