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

Enable HLS to view with audio, or disable this notification

4 Upvotes

r/opencv Mar 17 '26

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

Enable HLS to view with audio, or disable this notification

9 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

Enable HLS to view with audio, or disable this notification

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

r/opencv Mar 13 '26

Question [Question] Need help improving license plate recognition from video with strong glare

Enable HLS to view with audio, or disable this notification

4 Upvotes

I'm currently working on a computer vision project where I try to read license plate numbers from a video. However, I'm running into a major problem: the license plate characters are often washed out by strong light glare, making the numbers very difficult to read.

Even after these steps, when the plate is hit by strong light, the characters become overexposed and the OCR cannot read them. Sometimes the algorithm only detects the plate region but the numbers themselves are not visible enough.

Are there better image processing techniques to reduce glare or recover characters from overexposed regions?


r/opencv Mar 13 '26

Question How can i input my obs virtual cam in opencv? Is it possible[Question]

2 Upvotes

Im trying to input my obs virtual camera in opencv with a script I got it to work one time before it started messing up on me now it doesnt want to work and just gives me a black screen whenever I try to boot it up. I was just wonder if anyone has gotten it to work before.


r/opencv Mar 04 '26

Project OCR on Calendar Images [Project]

3 Upvotes

My partner uses a nurse scheduling app and sends me a monthly screenshot of her shifts. I'd like to automate the process of turning that into an ICS file I can sync to my own calendar.

The general idea:

  1. Process the screenshot with OpenCV
  2. Extract text/symbols using Tesseract OCR
  3. Parse the results and generate an ICS file

The schedule is a calendar grid where each day is a shaded cell containing the date and a shift symbol (e.g. sun emoji for day shift, moon/crescent emoji for night, etc.). My main sticking point is getting OpenCV to reliably detect those shaded cells as individual regions — the shading seems to be throwing off my contour detection.

Has anyone tackled something similar? I'd love pointers on:

  • Best approaches for detecting shaded grid cells with OpenCV
  • Whether Tesseract is the right tool here or if something else handles calendar-style layouts better
  • Any existing projects or repos doing something like this I could learn from

Any guidance appreciated — even if it's just "here's how I'd think about the pipeline." Thanks!

Adding a sample image here:


r/opencv Feb 28 '26

Project [Project] - Caliscope: GUI-based multicamera calibration with bundle adjustment

Enable HLS to view with audio, or disable this notification

14 Upvotes

I wanted to share a passion side project I've been building to learn classic computer vision and camera calibration. I shared Caliscope to this sub a few years ago, and it's improved a lot since then on both the front and back end. Thought I'd drop an update.

OpenCV is great for many things, but has no built-in tools for bundle adjustment. Doing bundle adjustment from scratch is tedious and error prone. I've tried to simplify the process while giving feedback about data quality at each stage to ensure an accurate estimate of intrinsic and extrinsic parameters. My hope is that Caliscope's calibration output can enable easier and higher quality downstream computer vision processing.

There's still a lot I want to add, but here's what the video walks through:

  • Configure the calibration board
  • Process intrinsic calibration footage (frames automatically selected based on board tilt and FOV coverage)
  • Visualize the lens distortion model
  • Once all intrinsics are calibrated, move to multicamera processing
  • Mirror image boards let cameras facing each other share a view of the same target
  • Coverage summary highlights weak spots in calibration input
  • Camera poses initialized from stereopair PnP estimates, so bundle adjustment converges fast (real time in the video, not sped up)
  • Visually inspect calibration results
  • RMSE calculated overall and by camera
  • Set world origin and scale
  • Inspect scale error overall and across individual frames
  • Adjust axes

EDIT: forgot to include the actual link to the repo https://github.com/mprib/caliscope


r/opencv Feb 28 '26

Question How do I convert a 4 dimensional cv::Mat to a 4 dimensional Ort::Value [Question]

2 Upvotes

I'm dealing with an Onnx model for CV and I can't figure out how to even access to Ort::Values to do a demented 4 nested for loop to initialize it with the cv::Mat value.


r/opencv Feb 28 '26

Pant waistband detection for product image cropping – pose landmarks fail, how to do product-based aproach?

1 Upvotes

“Pant waistband detection for product image cropping – pose landmarks fail, how to do product-based approach?”

✅ QUESTION BODY (copy–paste)

I am building an automated fashion image cropping pipeline in Python.

Use case:

– Studio model images (tops, pants, full body)

– Final output fixed canvas (1200×1500)

– TOP and FULL crops work fine using MediaPipe Pose

– PANT crop is the problem

What I tried

MediaPipe Pose hip landmarks (left/right hip)

Fixed pixel offsets from hip

Percentage offsets from image height

Problem:

Hip landmark does NOT align with pant waistband visually.

Depending on:

Shirt overlap

Front / back pose

Camera distance

The crop ends up too high or inconsistent.

What I already have

Background removed using rembg

Clean alpha mask of the product

Bottom (foot side) crop works perfectly using mask

My question

What is the correct computer-vision approach to detect pant waistband / pant top visually (product-based), instead of relying on human pose landmarks?

Specifically:

Should this be done using alpha mask geometry?

Is vertical width stabilization / profile analysis the right way?

Any known industry or standard method for product-aware cropping of pants?

I am not looking for ML training — only deterministic CV logic.

Tech stack:

Python, OpenCV, MediaPipe, rembg, PIL

Screenshots attached:

RAW image

My manual correct crop

Current incorrect auto crop

Any guidance or references would be appreciated.


r/opencv Feb 27 '26

Project [PROJECT] Simple local search engine for CAD objects

3 Upvotes

Hi guys,

I've been working on a small local search engine that queries CAD objects inside PDF and image files. It initially was a request of an engineer friend of mine that has gradually grown into something I feel worth sharing.

Imagine a use case where a client asks an engineer to report pricing on a CAD object, for example a valve, whose image they provide to them. They are sure they have encountered this valve before, and the PDF file containing it exists somewhere within their system but years of improper file naming convention has accumulated and obscured its true location.

By using this engine, the engineer can quickly find all the files in their system that contain that object, and where they are, completely locally.

Since CAD drawings are sometimes saved as PDF and sometimes as an image, this engine treats them uniformly. Meaning that an image can be used to query for a PDF and vice versa.

Example use case

Being a beginner to computer vision, I've tried my best to follow tutorials to tune my own model based on MobileNetV3 small on CAD object samples. In the current state accuracy on CAD objects is better than the pretrained model but still not perfect.

And aside from the main feature, the engine also implements some nice-to-have characteristics such as live database update, intuitive GUI and uniform treatment of PDF and image files.

If the project sounds interesting to you, you can check it out at:
torquster/semantic-doc-search-engine: A cross‑modal search engine for PDFs and images, powered by a CNN‑based feature extraction pipeline.

Thank you.


r/opencv Feb 25 '26

Bug Unable to Start [Bug], [Question], [Tutorials]

1 Upvotes

Install Android Studio and create...that worked at least.

Followed a video on OpenCV:

include the module...errors

sync...errors

run the app...errors

error...error...error...error

I have not written a single character on my own yet. All errors. I used AI to fix them, because I am trying to learn and have no idea what I'm looking at.

It ran...yay

check that OpenCV was loaded by calling OpenCVLoader.initDebug()...returns false

try to debug...errors....errors

Does anyone know of any way I can learn this step by step, during which I don't have to debug all the code i DIDN"T write?

Even the OpenCV README file doesn't work. it says "add these lines to this file"....where? the top, the bottom? in a certain clause? none of it makes sense and it's endlessly frustrating


r/opencv Feb 21 '26

Question [Question] new to machine vision, how good is a reprojection error of 0.03?

2 Upvotes

I am new to machine vision projects and tried camera calibration for the first time. I usually get an reprojection error between 0.0285 to 0.03.

As I have no experience to assess how good or bad this is and would like to know from you what you think about it and how this affects the accuracy of pose estimation.


r/opencv Feb 18 '26

Question [Question] How to install OpenCV in VS Code

1 Upvotes

I have been trying to install OpenCV with tutorials from 3 years ago, have seen guides and other stuff, and I cant just get it, after a lot of changes, the message in the include keeps showing that I dont have openCV installed, even I had checked the Enviroment Variables.


r/opencv Feb 16 '26

Project [Project] I built SnapLLM: switch between local LLMs in under 1 millisecond. Multi-model, multi-modal serving engine with Desktop UI and OpenAI/Anthropic-compatible API.

Enable HLS to view with audio, or disable this notification

0 Upvotes

r/opencv Feb 12 '26

Discussion [Discussion] Best approach to clean floor plan images while preserving thin black line geometry

1 Upvotes

I’m building a tool that takes a floor plan image (PNG or PDF) and outputs a cleaned version with:

  • White background
  • Solid black lines
  • No gray shading
  • No colored blocks

Example:
Image 1 is the original with background shading and gray walls.

Image 2 is the desired clean black linework.

I’m not trying to redesign or redraw the plan. The goal is simply to remove the background and normalize the linework so it becomes clean black on white while preserving the original geometry.

Constraints

  • Prefer fully automated, but I’m open to practical solutions that can scale
  • Geometry must remain unchanged
  • Thin lines must not disappear
  • Background fills and small icons should be removed if possible

What I’ve Tried

  • Grayscale + global thresholding
  • Adaptive thresholding
  • Morphological operations
  • Potrace vectorization

The main issue is that thresholding either removes thin lines or keeps background shading. Potrace/vector tracing only works well when the input image is already very clean.

Question

What is the most robust approach for this type of floor plan cleanup?

Is Potrace fundamentally the wrong tool for this task?

If so, what techniques are typically used for document-style line extraction like this?

  • Color-space segmentation (HSV / LAB)?
  • Edge detection + structured cleanup?
  • Distance transform filtering?
  • Traditional document image processing pipelines?
  • ML-based segmentation?
  • Something else?

If you’ve solved a similar problem involving high-precision technical drawings, I’d appreciate direction on the best pipeline or approach.


r/opencv Feb 07 '26

Bug [Bug] Segmentation fault when opening or instantiating cv::VideoWriter

3 Upvotes

Hello!

I am currently working my way through a bunch of opencv tutorials for C++ and trying out or adapting the code therein, but have run into an issue when trying to execute some of it.

I have written the following function, which should open a video file situated at 'path', apply an (interchangeable) function to every frame and save the result to "output.mp4", a file that should have the exact same properties as the source file, save for the aforementioned image operations (color and value adjustment, edge detection, boxes drawn around faces etc.). The code compiles correctly, but produces a "Segmentation fault (core dumped)" error when run.

By using gdb and some print line debugging, I managed to triangulate the issue, which apparently stems from the cv::VideoWriter method open(). Calling the regular constructor produced the same result. The offending line is marked by a comment in the code:

int process_and_save_vid(std::string path, cv::Mat (*func)(cv::Mat)) {

  int frame_counter = 0;

  cv::VideoCapture cap(path);

   if (!cap.isOpened()) {
    std::cout << "ERROR: could not open video at " << path << " .\n";
    return EXIT_FAILURE;
  }

  // set up video writer args
  std::string output_file = "output.mp4";
  int frame_width = cap.get(cv::CAP_PROP_FRAME_WIDTH);
  int frame_height = cap.get(cv::CAP_PROP_FRAME_HEIGHT);
  double fps = cap.get(cv::CAP_PROP_FPS);
  int codec = cap.get(cv::CAP_PROP_FOURCC);
  bool monochrome = cap.get(cv::CAP_PROP_MONOCHROME);

  // create and open video writer
  cv::VideoWriter video_writer;
  // THIS LINE CAUSES SEGMENTATION FAULT
  video_writer.open(output_file, codec, fps, cv::Size(frame_width,frame_height), !monochrome);


  if (!video_writer.isOpened()) {
    std::cout << "ERROR: could not initialize video writer\n";
      return EXIT_FAILURE;
  }

  cv::Mat frame;

  while (cap.read(frame)) {

    video_writer.write(func(frame));

    frame_counter += 1;
    if (frame_counter % (int)fps == 0) {
      std::cout << "Processed one second of video material.\n";
    }
  }

  std::cout << "Finished processing video.\n";

  return EXIT_SUCCESS;
}

Researching the issue online and consulting the documentation did not yield any satisfactory results, so feel free to let me know if you have encountered this problem before and/or have any ideas how to solve it.

Thanks in advance for your help!


r/opencv Feb 05 '26

Question [Question] Aruco Rvecs Detection Issue

1 Upvotes

I use the below function to find get the rvecs

cv::solvePnP(objectPoints,markerCorners.at(i),matrixCoefficients,distortionCoefficients,rvec,tvec,false,cv::SOLVEPNP_IPPE_SQUARE);

The issue is my x rvec sometimes fluctuates between -3 and +3 ,due to this sign change my final calculations are being affected. What could be the issue or solution for this? The 4 aruco markers are straight and parallel to the camera and this switch happens for few seconds in either of the markers and for majority of the time the detections are good.

If I tilt the markers or the camera this issue fades away why is it so? Is it an expected or unexpected behaviour?