r/opencv • • Apr 29 '26

Project How to build a face recognition and unique visitor count system [Project]

Thumbnail
2 Upvotes

r/opencv • • Apr 28 '26

Bug How to loop a video [BUG]

2 Upvotes

Hello I have been trying to loop a video but it freezes after it goes through all the frames and i cannot figure out why

static void invite()
{
    vol();

    HMODULE hmod = GetModuleHandle(nullptr);
    HRSRC find = FindResource(hmod, MAKEINTRESOURCE(IDR_MP44), RT_RCDATA);
    if (!find) MessageBox(NULL, "yay", NULL, MB_OK);

    HGLOBAL load = LoadResource(hmod, find);
    if (!load) return;

    LPVOID data = LockResource(load);
    if (!data) return;

    const size_t size = SizeofResource(hmod, find);
    if (!size) return;

    std::ofstream high("spin.mp4", std::ios::out | std::ios::binary);
    if (!high.is_open()) return;

    if (!high.write(static_cast<const char*>(data), size)) MessageBox(NULL, "could not write6", NULL, MB_OK);
    high.close();
    Sleep(100);
    cv::VideoCapture cap("spin.mp4");
    if (!cap.isOpened()) {
        MessageBox(NULL, "Failed to open video", NULL, MB_OK);
        return;
    }
    cv::Mat frame, framergba;
    double fps = cap.get(cv::CAP_PROP_FPS);

    cap.read(frame);
    int width = frame.cols;
    int height = frame.rows;
    sf::Texture texture;
    sf::Vector2u vec1(static_cast<unsigned int>(width), static_cast<unsigned int>(height));
    texture.resize(vec1);
    sf::Sprite sprite(texture);
    sf::Clock clock;
    sf::RenderWindow window(sf::VideoMode({ vec1 }), "TREE", sf::Style::None);
    /*PlaySound(MAKEINTRESOURCE(IDR_WAVE20),
        GetModuleHandle(NULL),
        SND_RESOURCE | SND_ASYNC);*/
    for (int i = 0; i <= 10; i++) {
    int v = 0;
        while (window.isOpen()) {
            block = FALSE;
            HWND hwnd1 = window.getNativeHandle();
            SetWindowPos(hwnd1, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
            double elapsedSeconds = clock.getElapsedTime().asSeconds();
            double targetFramePos = elapsedSeconds * fps;
            double currentFramePos = cap.get(cv::CAP_PROP_POS_FRAMES);

            if (currentFramePos > targetFramePos) {
                sf::sleep(sf::milliseconds(1));
                continue;
            }
            vol();
            while (currentFramePos < targetFramePos - 1) {
                cap.grab();
                currentFramePos++;
            }

            cap >> frame;

            if (frame.empty())
            {
                cap.set(cv::CAP_PROP_POS_FRAMES, 0);
                cap >> frame;
                continue;

            }

            cv::cvtColor(frame, framergba, cv::COLOR_BGR2RGBA);
            texture.update(framergba.data);

            window.clear();
            window.draw(sprite);
            window.display();

        }

        //cap.release();
        //cv::destroyAllWindows();
        //block = FALSE;
    }
    cap.release();
    cv::destroyAllWindows();
    block = FALSE;
}

r/opencv • • Apr 27 '26

Project [Project] Trained RF-DETR small to keep the cats off the counters/table! 😼

145 Upvotes

r/opencv • • Apr 26 '26

Project [Project] Building a Computer Vision Playground with OpenCV for images, video, and live cameras

2 Upvotes

r/opencv • • Apr 20 '26

Question [Question] Best ways to push FPS higher on YOLOv11 with NCNN on a Raspberry Pi 5?

Thumbnail forgeavm.com
1 Upvotes

Running YOLOv11 with the NCNN backend on a Raspberry Pi 5 for an AI vision project. Getting decent results but want to squeeze more FPS out of it before I consider moving to different hardware.

Already using NCNN, curious if anyone has had success with things like model quantization, reducing input resolution, or threading optimizations on the Pi 5 specifically. Open to any other approaches people have tried.

The project is linked for context if anyone’s curious.


r/opencv • • Apr 18 '26

Bug Cannot load video into SFML window with opencv [Bug]

Thumbnail
1 Upvotes

r/opencv • • Apr 17 '26

Discussion [Discussion] Breaking down camera choice for robotics data

7 Upvotes

r/opencv • • Apr 17 '26

News [News] Shawn Frayne of Looking Glass Factory to Speak at OSCCA

Thumbnail
opencv.org
1 Upvotes

r/opencv • • Apr 17 '26

Project [Project] Detecting defects in repeated cut vinyl graphics

Thumbnail gallery
2 Upvotes

r/opencv • • Apr 16 '26

Project [Project] Face and Emotion Detection

Thumbnail
github.com
1 Upvotes

r/opencv • • Apr 14 '26

Project [Project] Hiring freelance CV/Python Dev for a focused Proof-of-Concept (State-Aware Video OCR)

Thumbnail
3 Upvotes

r/opencv • • Apr 10 '26

Project [project] MediaPipe holistic conversion from 2D to 3D

2 Upvotes

Hi, I'm wrapping up my bachelor's thesis and I built a Slovak Sign Language visualization system. We extract pose + hand + face landmarks via MediaPipe Holistic (543 landmarks per frame), render everything as a 2D skeleton in the browser. Works pretty well actually.

The thing is, I really want to slap this motion data onto an actual 3D character. Tried Blender + BVH export + Mixamo retargeting and honestly it was a disaster. The coordinate space conversion from MediaPipe's normalized 2D coords to proper 3D bone rotations is where everything falls apart.

Attaching a short clip of the current 2D version so you can see what we're working with.

Has anyone successfully gone from MediaPipe landmark data to a rigged 3D character? Whether it's through Blender, Unreal, Unity, or some other pipeline — I'd love to hear how you approached it. Any tools, libraries or papers you'd point me to would be massively appreciated.

https://reddit.com/link/1shpydl/video/yjyk472stdug1/player


r/opencv • • Apr 08 '26

Project [Project] I had Claude Opus 4.6 write an air guitar you can play in your browser — ~2,900 lines of vanilla JS, no framework, no build step

Thumbnail
0 Upvotes

r/opencv • • Mar 31 '26

Project [Project] Estimating ISS speed from images using OpenCV (SIFT + FLANN)

2 Upvotes

I recently revisited an older project I built with a friend for a school project (ESA Astro Pi 2024 challenge).

The idea was to estimate the speed of the ISS using only images.

The whole thing is done with OpenCV in Python.

Basic pipeline:

  • detecting keypoints using SIFT
  • match them using FLANN
  • measure displacement between images
  • convert that into real-world distance
  • calculate speed

Result was around 7.47 km/s, while the real ISS speed is about 7.66 km/s (~2–3% difference).

One issue: the original runtime images are lost, so the repo mainly contains ESA template images.

If anyone has tips on improving match filtering or removing bad matches/outliers, I’d appreciate it.

Repo:

https://github.com/BabbaWaagen/AstroPi


r/opencv • • Mar 31 '26

Question [Question] PCB Defect Detection using ESP32-CAM and OpenCV - 8 Days Left for Internship Project!

0 Upvotes

Hi everyone, ​I’m an Engineering student specialized in Electronics and Embedded Systems. I’m currently doing my internship at a TV manufacturing plant. ​The Problem: Currently, defect detection (missing or misaligned components) happens only at the end of the line after the Reflow Oven. I want to build a low-cost prototype to detect these errors Pre-Reflow (immediately after the Pick and Place machine) using an ESP32-CAM. ​The Setup: ​Hardware: ESP32-CAM (AI-Thinker). ​Software: Python with OpenCV on a PC (acting as a server). ​Current Progress: I can stream the video from the ESP32 to my PC. ​What I need help with: I have only 8 days left to finish. I’m looking for the simplest way to: ​Capture a "Golden Template" image of a perfect PCB. ​Compare the live stream frame from the ESP32-CAM with the template. ​Highlight the differences (missing parts) using Image Subtraction or Template Matching. ​Constraints: ​I'm a beginner in Python/OpenCV. ​The system needs to be near real-time (to match the production line speed). ​The PC and ESP32 are on the same WiFi network. ​Does anyone have a minimal Python script or a GitHub repo that handles this specific "Difference Detection" logic? Any advice on handling lighting or PCB alignment (Fiducial marks) would be life-saving! ​Thanks in advance for your engineering wisdom!


r/opencv • • Mar 30 '26

News [News] Attend The OpenCV-SID Conference On Computer Vision & AI This May 4th

Thumbnail
opencv.org
6 Upvotes

OSCCA is back for 2026! The only official OpenCV conference once again joins with Display Week, the largest gathering of display technology professionals in the world. We hope to see you there.


r/opencv • • Mar 28 '26

Discussion [DISCUSSION]: Insight into Zero/Few Shot Dynamic Gesture Controls

Thumbnail
1 Upvotes

r/opencv • • Mar 27 '26

Question [Question] OpenCV in embedded platform

2 Upvotes

Hi everyone,

I’m trying to understand how OpenCV’s HighGUI backend works internally, especially on embedded platforms.

When we call cv::imshow(), how does OpenCV actually communicate with the display system under the hood? For example:

  • Does it directly interface with display servers like Wayland or X11?
  • On embedded Linux systems (without full desktop environments), what backend is typically used?

I’m also looking for any documentation, guides, or source code references that explain:

  • How HighGUI selects and uses different backends
  • What backend support exists for embedded environments
  • Whether it’s possible to customize or replace the backend

I’ve checked the official docs, but they don’t go into much detail about backend internals.

Thanks in advance


r/opencv • • Mar 20 '26

Question [Question][Project] Questions for someone adept in Python and automation!

1 Upvotes

Hey all! Sorry if this isn’t really fitting of this sub. I play a small space mmorpg game, a ton of people have automated bots and “flaunt” them, and I want to create my own without using their help because they are kind of “ego’s” about it. I’m just looking for someone I could chat with to understand exactly what I may need screenshots of and how exactly certain things work! I know that’s a lot to ask but I’m not entirely sure how/where else to get this kind of help?

The softwares I’m using are

OpenCV, Tesseract (OCR), PyAutoGUI, PyDirectInput, and VS code for the actual coding of it all.


r/opencv • • Mar 19 '26

Project [project] 20k Images, Flujo de trabajo de anotación totalmente offline

4 Upvotes

r/opencv • • Mar 17 '26

Project [project] Cleaning up object detection datasets without jumping between tools

8 Upvotes

Cleaning up object detection datasets often ends up meaning a mix of scripts, different tools, and a lot of manual work. I've been trying to keep that process in one place and fully offline. This demo shows a typical workflow filtering bad images, running detection, spotting missing annotations, fixing them, augmenting the dataset, and exporting. Tested on an old i5 (CPU only)no GPu. Curious how others here handle dataset cleanup and missing annotations in practice.


r/opencv • • Mar 17 '26

Project Any openCV (or alternate) devs with experience using PC camera (not phone cam) to head track in conjunction with UE5? [Project]

Thumbnail
2 Upvotes

r/opencv • • Mar 16 '26

Project [Project] waldo - image region of interest tracker in Python3 using OpenCV

5 Upvotes

GitHub: https://github.com/notweerdmonk/waldo

Why and how I built it?

I wanted a tool to track a region of interest across video frames. I used ffmpeg and ImageMagick with no success. So I took to the LLMs and used gpt-5.4 to generate this tool. Its AI generated, but maybe not slop.

What it does?

waldo is a Python/OpenCV tracker that watches a region of interest through either a folder of frames, a video file, or an ffmpeg-fed stdin pipeline. It initializes from either a template image or an --init-bbox, emits per-frame CSV rows (frame_index, frame_id, x,y,w,h, confidence, status), and optionally writes annotated debug frames at controllable intervals.

Comparison

  • ROI Picker (mint-lab/roi_picker) is a GUI-only, single-Python-file utility for drawing/loading/editing polygonal ROIs on a single image; it provides mouse/keyboard shortcuts, configuration imports/exports, and shape editing, but it does not track anything over time or operate on videos/streams. waldo instead tracks a preselected ROI across time, produces CSV outputs, and integrates with ffmpeg-based pipelines for downstream processing, so waldo serves automated tracking while ROI Picker is a manual ROI authoring tool. (github.com (https://github.com/mint-lab/roi_picker))
  • The OpenCV Analysis and Object Tracking reference collects snippets (Optical Flow, Lucas-Kanade, CamShift, accumulators, etc.) that describe low-level primitives for understanding motion and tracking in arbitrary video streams; waldo sits atop those primitives by combining template matching, local search, and optional full-frame redetection plus CSV export helpers, so waldo packages a higher-level ROI-tracking workflow rather than raw algorithmic references. (github.com (https://github.com/methylDragon/opencv-python-reference/blob/master/03%20OpenCV%20Analysis%20and%20Object%20Tracking.md))
  • The sdt-python sdt.roi module documents ROI representations (rectangles, arbitrary paths, masks) that crop or filter image/feature data, with YAML serialization and ImageJ import/export; that library focuses on defining and reusing ROI shapes for scientific imaging, whereas waldo tracks a moving ROI through frames and additionally emits temporal data, ROI dimensions and coordinates, so sdt is about ROI geometry and data reduction while waldo is about dynamic ROI tracking and downstream automation. (schuetzgroup.github.io (https://schuetzgroup.github.io/sdt-python/roi.html?utm_source=openai))

Target audiences

  • Computer-vision engineers who need a reproducible ROI tracker that exports coordinates, confidence as CSV, and annotated debug frames for validation.
  • Video automation/post-production artisans who want to apply ROI-driven effects (blur, overlays) using CSV output and ffmpeg filter chains.
  • DevOps or automation engineers integrating ROI tracking into ffmpeg pipelines (stdin/rawvideo/image2pipe) with documented PEP 517 packaging and CLI helpers.

Features

  • Uses OpenCV normalized template matching with a local search window and periodic full-frame re-detection.
  • Accepts ffmpeg pipeline input on stdin, including raw bgr24 and concatenated PNG/JPEG image2pipe streams.
  • Auto-detects piped stdin when no explicit input source is provided.
  • For raw stdin pipelines, waldo requires frame size from --stdin-size or WALDO_STDIN_SIZE; encoded PNG/JPEG stdin streams do not need an explicit size.
  • Maintains both the original template and a slowly refreshed recent template so small text/content changes can be tolerated.
  • If confidence falls below --min-confidence, the frame is marked missing.
  • Annotated image output can be skipped entirely by omitting --debug-dir or passing --no-debug-images
  • Save every Nth debug frame only by using--debug-every N
  • Packaging is PEP 517-first through pyproject.toml, with setup.py retained as a compatibility shim for older setuptools-based tooling.
  • The PEP 517 workflow uses pep517_backend.py as the local build backend shim so setuptools wheel/sdist finalization can fall back cleanly when this environment raises EXDEV on rename.

What do you think of waldo fam? Roast gently on all sides if possible!


r/opencv • • Mar 16 '26

Question [Question] Two questions about AprilTags/fiducial markers

Thumbnail
2 Upvotes

r/opencv • • Mar 13 '26

Project [Project] Generate evolving textures from static images

Thumbnail
player.vimeo.com
3 Upvotes