(frame)
| 38 | ) |
| 39 | |
| 40 | def transform_func(frame): |
| 41 | global timestamp |
| 42 | global res |
| 43 | if not(a.work_flag): |
| 44 | return res |
| 45 | h, w = frame.shape[:2] |
| 46 | d = int(min(h, w) * cropping) |
| 47 | mh = (h - d) // 2 |
| 48 | mw = (w - d) // 2 |
| 49 | |
| 50 | frame = frame[mh:h-mh,mw:w-mw,:] |
| 51 | if(webrtc_mode): |
| 52 | frame = frame[:,:,::-1] |
| 53 | a.push_input(frame) |
| 54 | current_timestamp = time.time() |
| 55 | if(current_timestamp - timestamp >= 1.0 / (a.fps + len(a.output_pile) * 2 )): |
| 56 | u = a.fetch_one_frame() |
| 57 | if not (u is None): |
| 58 | res = u |
| 59 | if (webrtc_mode): |
| 60 | res = (255.0 * res).astype(np.uint8) |
| 61 | res = cv2.cvtColor(res, cv2.COLOR_RGB2BGR) |
| 62 | timestamp = current_timestamp |
| 63 | return res |
| 64 | |
| 65 | def fuse_ref(img): |
| 66 | if(a.vae is None): |
nothing calls this directly
no test coverage detected