MCPcopy Create free account
hub / github.com/SunOner/sunone_aimbot / FrameParser

Class FrameParser

logic/frame_parser.py:21–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 self.h = h
20
21class FrameParser:
22 def __init__(self):
23 self.arch = self.get_arch()
24 self._center = None
25 self._center_cache_key = None
26
27 def parse(self, result):
28 if result is None:
29 self._handle_no_detections()
30 return
31
32 if isinstance(result, sv.Detections):
33 self._process_sv_detections(result)
34 else:
35 self._process_yolo_detections(result)
36
37 def _process_sv_detections(self, detections):
38 if len(detections) > 0:
39 if cfg.show_window or cfg.show_overlay:
40 visuals.draw_helpers(detections)
41 target = self.sort_targets(detections)
42 self._handle_target(target)
43 else:
44 self._handle_no_detections()
45
46 def _process_yolo_detections(self, results):
47 frames = (results,) if hasattr(results, "boxes") else results
48 processed = False
49
50 for frame in frames:
51 processed = True
52 boxes = getattr(frame, "boxes", None)
53 if boxes is not None and len(boxes) > 0:
54 target = self.sort_targets(frame)
55 self._handle_target(target)
56 self._visualize_frame(frame)
57 else:
58 self._handle_no_detections()
59
60 if not processed:
61 self._handle_no_detections()
62
63 def _handle_target(self, target):
64 if target:
65 if hotkeys_watcher.clss is None:
66 hotkeys_watcher.active_classes()
67
68 if target.cls in hotkeys_watcher.clss:
69 mouse.process_data((target.x, target.y, target.w, target.h, target.cls))
70
71 def _visualize_frame(self, frame):
72 if cfg.show_window or cfg.show_overlay:
73 if cfg.show_boxes or cfg.overlay_show_boxes:
74 visuals.draw_helpers(frame.boxes)
75
76 if cfg.show_window and cfg.show_detection_speed:
77 visuals.draw_speed(frame.speed['preprocess'], frame.speed['inference'], frame.speed['postprocess'])
78

Callers 1

frame_parser.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected