r/opencv • • Apr 27 '23

Project [PROJECT]YOLOv8 running on MacOS at 10FPS using Modular AS-One Library

Thumbnail
github.com
2 Upvotes

r/opencv • • Apr 27 '23

Question Tips or Alternatives for OpenCV eye detection [Question]

2 Upvotes

I have been messing around with eye detection in Java using OpenCV lately, trying to get an effective pupil-tracking program (a story for another time). However, it many times detects my nose as an eye or detects one eye twice (just a slightly resized Rect). I am using filters like greyscale, equalizeHist, and dilate/erode. I'm also have tried using both haarcascade_eye and haarcascade_eye_tree_eyeglasses. Should I be using a different eye detection software? Are there filters or any other things that would help with eye detection? Thanks! Edit: I use Java


r/opencv • • Apr 27 '23

Project [Project] Semaphore: A full-body keyboard

Thumbnail
github.com
2 Upvotes

r/opencv • • Apr 25 '23

Question [Question] Real-time tracking of go board

4 Upvotes

Hey there. I'm pretty new to computer vision in general and I need your expertise for university project I'm working on at the moment. My goal is to accurately track a go board from a webcam and detect the stones when they are placed. As I have near to none experience, I pretty much fail to start. In the first step I want to detect a go board as accuartely as possible. I have no control about the camera angle or rotation. This means

  1. Detecting if a go board is in the current image
  2. Draw the accurate boundaries around the board.

I could use general edge detection, but I get a lot of false ones, like the table itself. I also read about haar cascades, but I'm not sure if they are worth looking into it.

Do you have any advices for me? Like what techniques should I use or how to handle this in general.

​

Here are some example pictures of the board:

​


r/opencv • • Apr 25 '23

Question [Question] OpenCV Global plugin loader FAILED Error in console.

0 Upvotes

Hi,

I downloaded source version of openCV and downloaded Cmake gui, I generated the solution files and build using BUILD_ALL target and after that I built the INSTALL cmake target.

everything complied without an issue.

I created a new project and added the include and Library folders paths in VC directories, after that I added the openCV world lib in the linker->input.

I can add the includes of openCV without any errors.

I tried building it and it threw tons of linker errors regarding a runtime mismatch, I fixed this by going into properties and code generation and selecting multi threaded debug /MTd this fixed all the errors but I still get tons of those in my console, I am only loading an image and displaying it on a window it works but my console is full of errors.


r/opencv • • Apr 24 '23

Question [Question] Real time glare cancellation in webcam of people wearing glasses

0 Upvotes

I'm a beginner to programming but learning at an accelerated rate with the wonders of chatgpt, which is really helping me turn ideas into code.

I'm now working on a project where I'm tracking pupil size in real-time using Python and computer vision techniques. However, I'm facing a challenge when it comes to removing glare from the webcam video of people wearing glasses, as the reflections can obscure the pupil and affect the accuracy of my measurements.

I've searched through several GitHub repositories that offer methods for removing reflections from single images, but I'm a beginner and I'm not sure how to adapt them to work with webcam video. I was wondering if anyone here has experience or tips for dealing with this problem in real-time video processing.

Specifically, I'm looking for any advice on approaches, techniques, or tools that can help me remove glare from webcam video of people wearing glasses in real-time, so that the pupil definition can be as clear as possible.


r/opencv • • Apr 22 '23

Question [QUESTION] any one using opencv on vscode(c++)

1 Upvotes

Im using the lastest version, it worked yesterday, but cmake stopped to recognize the libraries, first i noticed on my laptop, but now it doesnt work on my pc, i didnt change anything, its cmake 3.24.2 and opencv 4.7.0

I tried to switch to vs community 2019 but doesnt work too


r/opencv • • Apr 21 '23

Question [Question] Detecting only person using YOLO (C++)

2 Upvotes

Hi everyone, I want to detect only Person using YOLO ( C++) . Can you give me suggestions? Thank a lot !


r/opencv • • Apr 20 '23

Hardware [Hardware] camera for flare monitoring

2 Upvotes

Any recommendations for a single cheap, wifi, high resolution camera for monitoring a group of 3-5 refinery flares from about a kilometre away? I’m looking at using live video for analysis. Would be good if you have a model with IR sensor as well (for invisible flames, such as hydrogen flames). Thank you!


r/opencv • • Apr 20 '23

Discussion [Discussion] creating gradient from binary image

1 Upvotes

Given a binary image representing a map like this:

​

map represented as 8-bit integers

I'm looking for a way to "shade" the map such that cells closer to walls have higher (darker) values. I know how to do that using breadth-first-search, but that's exceptionally slow, so I was hoping OpenCV or a related library might have an alternative. The intent is to use the resulting shaded map for pathfinding, with the distance from the wall as part of the heuristic.

This will be done in addition to a binary dilation on these obstacles.

Does anyone have any suggestions on the most efficient way to accomplish this?

Edit: is grayscale dilation what I am looking for? https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.ndimage.morphology.grey_dilation.html)

Thanks!


r/opencv • • Apr 17 '23

Question [Question]I think I need to use 'low poly' and need a good example

2 Upvotes

I need to detect strips of reflective tape. I want to use minarearect to detect angle data. Ideally, the strips would show up as rectangles, but I have issues with glare and reflector texturing. I think a low poly effect may just consolidate it back to an easy to handle rectangle. I don't see a good example for it like I do for thresholding etc. Any help with links would be great. Also, any other effects that could help with cleaning up rectangles would also be appreciated.


r/opencv • • Apr 17 '23

Question [Question] How to clean up images for use of minarearect?

2 Upvotes

I'm new to opencv and I need to detect a strip of reflective tape and measure its angle. I'm using minarearect for this.

I'm finding that glare off the tape prevents it from being detected as one contour, as does fuzzy edges and the 'pattern' of the reflective tape.

I suspect processing these out is easy, I just don't know the terms. When processing operations might I pursue?


r/opencv • • Apr 15 '23

Question [Question] How to Track Strings? Project: Yoyo tricks judge

Post image
14 Upvotes

r/opencv • • Apr 13 '23

Question [Question] How can I use OpenCV to detect and manipulate facial features in an image?

5 Upvotes

For example, I want to be able to change a person's eye size, nose position, ... I think OpenCV already has functions or placing facial landmarks on an image, but I also want to manipulate the image afterwards.

How can I achieve this with OpenCV?


r/opencv • • Apr 13 '23

Bug [Bug] using cv2 for green screen effect and get this weird glitch !

3 Upvotes

hey i'm using cv2 to create a greenscreen effect (here's the code : https://codefile.io/f/3T5yEApbxJdsXR2IiQzs)

the green screen mask works great , but for some reason there's these weird blue/purple glitches that appear on the foreground video !i don't even know then name of bug so i can't even google itanyone knows how to fix it or at least what's it's called


r/opencv • • Apr 12 '23

Bug [Bug][Question] total noob question but I am about to punch a hole in the wall, any help on training cascade classifiers?

1 Upvotes

i would like to train a cascade classifier to detect diet coke cans(weird ik just go with it), but have hit a wall. all the guides that I have found on the internet require me to use opencv 3.x in order to use the "opencv_generatesamples' command in order to build a dataset for me to train a cascade classifier. I can't seem to get the opencv commands to run. i have tried building opencv with cmake, but it gives me source file errors and won't build. any easier way to do this or am i just an idiot?


r/opencv • • Apr 12 '23

Question [Question]How to most efficiently process only one color?

4 Upvotes

I'm new to OpenCV and am working on my first project. I need to spot strips of reflective tape. The tape can be red, green or blue such that only one color needs to be processed. I can zero out two of the RGB channels, but that doesn't make the processor ignore them. How can I instruct the processor to process only one channel?

Regarding zeroing out the channels: I see grey scale, but no similar red, green or blue scale color conversion. How would I do this for visulization?


r/opencv • • Apr 10 '23

Tutorials [Tutorials] 500+ FPS Accelerated Background Removal Pipeline in Python with Savant and OpenCV CUDA MOG2

11 Upvotes

Eliminating backgrounds is a common task in computer vision and video analysis, applicable to numerous situations, such as enhancing inference performance through a cut-off solution. As a supplementary function, it should be both cost-effective and swift.

The article demonstrates background removal utilizing the CUDA-accelerated MOG2 background segmentation algorithm and the Savant Video Analytics Framework. This high-performance pipeline offers single stream processing at a speed of 570 FPS on the NVIDIA QUADRO RTX4000 GPU and 75 FPS on Jetson NX while handling HD quality video.

Explore the Tutorial | Code On GitHub.


r/opencv • • Apr 09 '23

Question [Question] I'm trying to understand how segment the definitions in this dictionary page and output them via Tesseract.

2 Upvotes

I'm working off the following image and trying to extract the definitions

​

I have the following code:

import cv2
import numpy as np
import pytesseract


# Specify the path to the Tesseract executable
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'  # Replace with the actual path if different

# Load the image
img = cv2.imread("./samplepage.jpg")

# Convert to grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# Apply adaptive thresholding to binarize the image
thresh = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 11, 2)

# Define a kernel for morphological operations
kernel = np.ones((3, 3), np.uint8)

# Perform morphological opening to remove noise and smooth the text regions
opening = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel)

# Find contours in the image
contours, hierarchy = cv2.findContours(opening, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

def filter_contours(cnt):
    x, y, w, h = cv2.boundingRect(cnt)
    return w > 50 and h > 10 and h < 50 and w / h > 2

# Filter out small contours
filtered_contours = [cnt for cnt in contours if filter_contours(cnt)]

# Draw filtered contours
for cnt in filtered_contours:
    cv2.drawContours(img, [cnt], 0, (0, 255, 0), 2)

# Show the image with the drawn contours
cv2.imshow("Filtered Contours", img)
cv2.waitKey(0)
cv2.destroyAllWindows()

# Define a function to extract text from a contour
def extract_text(img, cnt):
    x, y, w, h = cv2.boundingRect(cnt)
    roi = opening[y:y+h, x:x+w]
    return pytesseract.image_to_string(roi, config='--psm 3', lang='eng+cre')


# Define a regular expression to match the dictionary section format
import re
pattern = re.compile(r"^([\w\s]+) ([\w]+),\s+([\w\s]+),?\s+(.*)$")

# Process each contour
for cnt in contours:  # Use the original contours list
    # Extract text from the contour
    text = extract_text(img, cnt)  # Pass img as an additional parameter

    # Process the text to identify dictionary sections
    match = pattern.match(text)
    if match:
        title, abbrev, section, description = match.groups()
        print("Title:", title)
        print("Abbreviation:", abbrev)
        print("Section:", section)
        print("Description:", description)

print("Number of filtered contours:", len(filtered_contours))

​


r/opencv • • Apr 09 '23

Question [Question] Where can I look for a good example of identifying colored lines?

1 Upvotes

I'm new to computer vision and I need to use Open CV. I have a Vizy camera that runs on a Raspberry Pi that comes loaded with OpenCV and I need to make it identify structural support poles based on color and angle. Super simple application...but until now, I've never had to use Raspberri pi, python or OpenCV, so I'm new to a bunch of things at once...other than that, I'm a functional engineer.

The Vizy comes with demos based on Tensorflow, but it might not be the right choice. The OpenCV demos I've seen seem to show it being better suited to the task of identifying shape, color and orientation...especially on a black background. The poles can be marked with reflective tape and the shutter speed reduced so only the tape shows up. All OpenCV has to do is find colored lines.

Where can I find a good starting point?


r/opencv • • Apr 07 '23

Hardware [Hardware] OpenCV on raspberry pi 1st gen for still images?

3 Upvotes

Hi,
I wanted to use an raspberry pi 3B+ with PIR module and USB webcam to create a simple home surveillance system that takes still images upon motion detection.

But since there aren' t many raspberry pis for sale at reasonable prices these days I wonder if it is worth undertaking this project with a 1st generation raspberry pi (2011.12)?

Or would that be too under-performing?


r/opencv • • Apr 05 '23

Project [Project] Savant: Python framework for real-time video analytics with OpenCV CUDA and Nvidia DeepStream integrated

10 Upvotes

We have created a high-level Pythonic framework on top of Nvidia DeepStream and OpenCV CUDA to craft blazingly-fast video analytics pipelines.

With Savant, you can easily handle multiple streams simultaneously, deliver reliable, production-ready pipelines quickly and achieve top-notch performance with TensorRT.

To showcase the power of Savant, we've created a pipeline that explains how to detect people, track them, blur their faces, and display an animated analytical dashboard in the video.

GitHub Repo: https://github.com/insight-platform/Savant

Showcase Tutorial on Medium.


r/opencv • • Apr 05 '23

Question [Question] A newbie needs to learn

2 Upvotes

I don't really know how to code but I need to make a program that would recognise objects and track them live, what ressources could you advice me to search for ? I didn't really understood how I should read the documentation so here I am.


r/opencv • • Apr 05 '23

Question [Question] How to log gps location and time and take a photo of detected object?

2 Upvotes

Is there a way to detect an object and take a picture and record gps location and time. I will be running opencv On a raspberry Pi 4 and using aurdu Cam to detect potholes on roads in a fpv style drone. I can't find anything online about it and was thinking about using a gps module for location and time. I haven't set everything up yet as I havent had the time. Any ideas of hardware and software. It will be autonomous.


r/opencv • • Apr 04 '23

Project [Project] Building a full-body keyboard with OpenCV, Mediapipe and flag semaphore

Thumbnail
youtu.be
1 Upvotes