Skip to content

Instantly share code, notes, and snippets.

View tedliosu's full-sized avatar
💭
I may be slow to respond.

Ted Li tedliosu

💭
I may be slow to respond.
  • Ohio State University - Main Campus
  • 15:52 (UTC -05:00)
View GitHub Profile
@tedliosu
tedliosu / cv2_canny_cpu_vs_opencl.py
Created October 7, 2025 06:04
OpenCV Canny Microbenchmark - CPU (multithreaded) vs GPU (OpenCL/UMat)
# cv2_canny_cpu_vs_opencl.py
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2025 Yensong Ted Li
# Licensed under the Apache License, Version 2.0 (see http://www.apache.org/licenses/LICENSE-2.0)
#
# About this script:
# Microbenchmark of OpenCV Canny on the same image: CPU (multithreaded) vs GPU (OpenCL/UMat).
# Uses preallocated buffers and blocked medians for stable per-frame latency (ms);
# reports median/min/max/std and a CPU-GPU pixel-diff count; no GUI required.
# Note: operator-level microbenchmark only — excludes I/O/transfer and end-to-end pipeline effects.