Skip to content

Commit

Permalink
#43 create logo_gpu_mat at each iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
tomskikh committed Jan 26, 2023
1 parent 7e821a8 commit 56fbfc2
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions gpumat/dsapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def pad_buffer_probe(
pad: Gst.Pad,
info: Gst.PadProbeInfo,
logo: np.ndarray,
logo_gpu_mat: cv2.cuda.GpuMat,
cpu: bool,
measurements: List[float],
):
Expand All @@ -59,7 +58,7 @@ def pad_buffer_probe(
np_frame[:logo_height, :logo_width] = logo
else:
with nvds_to_gpu_mat(gst_buffer, nvds_frame_meta) as frame_mat:
alpha_comp(frame_mat, logo_gpu_mat, (0, 0))
alpha_comp(frame_mat, logo, (0, 0))
ts2 = time.time()
measurements.append((ts2 - ts1) * scale)

Expand Down Expand Up @@ -217,15 +216,11 @@ def main(args):
sys.stderr.write("Unable to get sink pad")
else:
logo = cv2.imread('logo.png', cv2.IMREAD_UNCHANGED)
# print(f'{logo=}')
print(f'{logo.shape=}')
logo_gpu_mat = cv2.cuda.GpuMat(logo)
print(f'{logo_gpu_mat=}')
sink_pad.add_probe(
Gst.PadProbeType.BUFFER,
pad_buffer_probe,
logo,
logo_gpu_mat,
is_cpu,
measurements,
)
Expand Down

0 comments on commit 56fbfc2

Please sign in to comment.