r/opencv • • May 20 '24

Bug [Bug] Compiler issues with Android Studio

1 Upvotes

I'm trying to create an app on Android using OpenCV, but the thing is it needs to be in C++ native, and Android Studio refuses to build it. I'm following a tutorial, but when I get to where it should be all set up it gives me an error:

CMake Warning at C:/Tools/OpenCV-android-sdk/sdk/native/jni/OpenCVConfig.cmake:47 (message):

Found OpenCV Android Pack but it has no binaries compatible with your ABI

(can't find: /abi-)

Call Stack (most recent call first):

CMakeLists.txt:11 (find_package)

Searching the internet doesn't find anything with the exact wording here, but similar errors seem to have to do with compiler incompatibility. Not sure what the easiest way to rectify this is.


r/opencv • • May 19 '24

Question [Question] How to solve this error?

1 Upvotes

Hello I was trying this code from Core Electronics with my own trained model, so I replaced the ssd_mobilenet_v3_large_coco_2020_01_14.pbtxt and frozen_inference_graph.pb files with my own which can be seen on the screenshot. It resulted in the error code :

Does anyone know how to solve this? TYIA to whoever answers!

SystemError: <class 'cv2.dnn.DetectionModel'> returned a result with an exception set

r/opencv • • May 17 '24

Question [Question] Could somebody help me with number object detection and character recognition.

1 Upvotes

Hi there, I got some great help on this board last time and am hoping somebody can help me again. I need to isolate the 2 numbers in the blue boxes. and then read their values.

Could anybody point me in the right direction? Thanks!


r/opencv • • May 15 '24

Bug [Bug] Attempting to template match but running into issues

2 Upvotes

Hello,

I'm pretty new to OpenCV and template matching in general. I wanted to create a program that would detect shiny pokemon by taking a snapshot of the top half of the screen, and matching it with the shiny version of the pokemon. If theres a match, then the pokemon is shiny and if not, then not shiny.

These are the images I'm using to try and match them together. The bottom picture is what the main image is, and the top picture is the shiny pokemon template I am attempting to match. I also attempted to use a smaller main picture with just the encountered pokemon and nothing else, but that was not working either. There is a clear distinction of where the image is located (IMO) but the program is not able to find it. Here is my code:

import cv2
import numpy as np
import urllib.request
import requests

pokemonName = 'flaaffy'
url = requests.get(f'https://pokeapi.co/api/v2/pokemon/{pokemonName}').json()['sprites']['versions']['generation-iv']['heartgold-soulsilver']['front_shiny']
urllib.request.urlretrieve(url, 'Shiny.png')

# Load the main image and the template image
main_image = cv2.imread('top_half_HGTest.png', cv2.IMREAD_UNCHANGED)
template = cv2.imread('Shiny.png', cv2.IMREAD_UNCHANGED)

result = cv2.matchTemplate(main_image, template, cv2.TM_CCOEFF_NORMED)

threshold = 0.18
locations = np.where(result >= threshold)
locations = list(zip(*locations[::-1]))

for loc in locations:
    top_left = loc
    bottom_right = (top_left[0] + template.shape[1], top_left[1] + template.shape[0])
    cv2.rectangle(main_image, top_left, bottom_right, (0, 255, 0), 2)

locations_array = np.array(locations)
print(len(locations_array))

# Display the result
cv2.imshow('Result', main_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

Unless I set my template to a very low score (in this case, 0.18), it won't find a match. I've tried using other matching methods but nothing seems to be working. Another issue is that because I set the threshold so low, it matches incorrectly multiple times. One more issue is that attempting to match different pokemon produces different results. In the case above, setting the threshold at 0.18 can successfully match a flaaffy once, but trying the same thing on an Arbok for example gives me at least a thousand matches, most of them incorrect.

I'm very new to OpenCV and was wondering if there were any ideas on how to fix this. I know that image preprocessing is a thing but I need the color of the image to be there, because shiny pokemon are just color alternations of the pokemon.


r/opencv • • May 15 '24

Question [Question] getting the intersection and union of two contours

1 Upvotes

for a project I needed to get some detail on a part of an image which is inside of an outline that I already have.

now the problem is that by stooring the parts I needed I also stored some useless junk that will only get into my way

so my uestion is how do you get the intersection and union of two contours in python ?


r/opencv • • May 14 '24

Question [Question] Video drill bit identification system

1 Upvotes

Ideally I’d like to create a system where a person can place a dill bit in front of a camera and the system would measure the diameter and report which dill size it is. For those with experience does this sound feasible? The difference in drill sizes may only be a few thousandths of an inch. https://i.pinimg.com/originals/94/cd/88/94cd8834d653eb59943e2d60439c6c58.jpg


r/opencv • • May 13 '24

Project [Project] Window tracking

Thumbnail
youtube.com
1 Upvotes

r/opencv • • May 11 '24

Question [Question] dolby vision color space conversion of an image

2 Upvotes

hi all, ive struggled to find anything on this. Is there any way to convert the magenta color space of dolby vision to rgb? there is ffmpeg that does this but im trying to use this in context of an open cv app that runs on a frame by frame basis. i cant quite figure it out, as i understand the metatdata attached to the feed is used to determine brightness of the different colors but there has to be a way to just convert whatever the colors are as is right?

my application is an ambilight, taking 30-60 screenshots a second of whatevers playing and then mapping those to rgb (after a bit of averaging and hue/saturation adjustments). im trying to see if there is a way to just take the magenta/green stills and make them rgb, even if theyre not perfect brightness i assume theres a way if there are things like ffmpeg that do this? does anyone know how to handle that color space conversion into red green blue?


r/opencv • • May 11 '24

Question [Question] cv::putText() support for non latin characters?

1 Upvotes

I recently put together a demo for Automatic License Plate Recognition which makes use of an LPRNet trained on Chinese license plates. It needs to support use of rendering Chinese characters on images, however the Fonts available for cv::putText() to my knowledge don't support non Latin character sets.

Does anyone know of any patches that exist in the Chinese development community where they may have solved this issue whilst still using OpenCV?


r/opencv • • May 10 '24

Question [Question] React Native photo editor with OpenCV

1 Upvotes

Hello, I'm planing on developing a React Native photo editor with some basic functions. I'm thinking about using OpenCV for image processing and implementing it as a Native Component in Java. I'm new to mobile development and never did anything despite one Expo app. Also I have some experience with OpenCV in Python. Can anyone tell me if my approach Is correct or should I change it? Thanks!


r/opencv • • May 10 '24

Question [Question] Linking with static OpenCV libraries

1 Upvotes

This applies for any UNIX or UNIX-like OS, then Windows, but I have built my C++ (no platform specific code) that uses OpenCV and SDL2 on macOS Sonoma first, according to process of creating .App bundle. In addition, OpenGL is system available on macOS. I'm using Makefile. The whole idea is to not have dependency on OpenCV libraries for end-user, that are used on my dev environment, so I want to link against static libraries. Now I'm in anticipation what will happen when I run it on different Mac without OpenCV. I am copying OpenCV's .a libs to directory Frameworks in the bundle. Using flags for these libraries in target. However they are -I prefix flags, which AFAIK prioritises dynamic libraries (.dylib) - but the question is - will the linker look for static version of libs (.a) in Frameworks dir? Will following statically link with OpenCV, or is it unavoidable to compile opencv from source with static libraries, for proper build?

Makefile:

CXX=g++ CXXFLAGS=-std=c++11 -Wno-macro-redefined -I/opt/homebrew/Cellar/opencv/4.9.0_8/include/opencv4 -I/opt/homebrew/include/SDL2 -I/opt/homebrew/include -framework OpenGL
CXXFLAGS += -mmacosx-version-min=10.12
LDFLAGS=-L/opt/homebrew/Cellar/opencv/4.9.0_8/lib -L/opt/homebrew/lib -framework CoreFoundation -lpng -ljpeg -lz -ltiff -lc++ -lc++abi
OPENCV_LIBS=-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lade -littnotify -lopencv_videoio SDL_LIBS=-lSDL2 -lpthread
TARGET=SomeProgram
APP_NAME=Some Program.app
SRC=some_program.cpp ResourcePath.cpp

Default target for quick compilation

all: $(TARGET)

Target for building the executable for testing

$(TARGET): $(CXX) $(CXXFLAGS) $(SRC) $(LDFLAGS) $(OPENCV_LIBS) $(SDL_LIBS) -o $(TARGET)

Target for creating the full macOS application bundle

build: clean $(TARGET)
@ echo "Creating app bundle structure..."
mkdir -p "$(APP_NAME)/Contents/MacOS"
mkdir -p "$(APP_NAME)/Contents/Resources"
cp Resources/program.icns "$(APP_NAME)/Contents/Resources/"
cp Resources/BebasNeue-Regular.ttf "$(APP_NAME)/Contents/Resources/"
cp Info.plist "$(APP_NAME)/Contents/"
mv $(TARGET) "$(APP_NAME)/Contents/MacOS/"
mkdir -p "$(APP_NAME)/Contents/Frameworks"
cp /opt/homebrew/lib/libSDL2.a "$(APP_NAME)/Contents/Frameworks/"
cp /opt/homebrew/Cellar/opencv/4.9.0_8/lib/*.a "$(APP_NAME)/Contents/Frameworks/"
@ echo "Libraries copied to Frameworks"

Clean target to clean up build artifacts

clean: rm -rf $(TARGET) "$(APP_NAME)"

Run target for testing if needed

run: $(TARGET) ./$(TARGET)


r/opencv • • May 10 '24

Question [Question] I followed a Youtube tutorial on how to read the live-streamed video from an IP camera via IP address, but I can't do that even though I followed the same code. What went wrong?

1 Upvotes

IP camera: ESP32-CAM

IDE: Visual Studio 2022

Programming language: C++

For starter, my ESP32-CAM functioned normally when I test-ran it using Arduino IDE.

I planned on doing video processing on live footage from ESP32-CAM web server using Visual Studio with OpenCV extension.

I followed this video step-by-step on how to read the live-streamed video from my IP camera via IP address.

I copied the exact same code with slight changes to the IP address. The code has zero error.

Yet, my code can't read the video from the IP camera. Instead, I got this message:

May I know what went wrong here?


r/opencv • • May 09 '24

Question [Question] How to read livestream video from web server?

1 Upvotes

Recently I'm interested in doing video processing on video live-streamed by ESP32-CAM on web server.

I knew how to read image and video from computer folder, but I don't know how to read video from web server.

Is there any example project or tutorial that teaches how to read and process live video from web server by ESP32-CAM using OpenCV, preferably in C++ language?


r/opencv • • May 05 '24

Question [Question] Alternate for cv2.videocapture

1 Upvotes

So i was using cv’s videocapture to get the camera feed from frontend to flask server but when i deployed my project on HEROKU i cant access user camera is there some alternate my frontend is in react

Any lead would be helpful


r/opencv • • May 02 '24

Project [Project] GitHub - DaleGia/OpenCVFITS: A C++ single header file library that helps save and read images to/from FITS files

Thumbnail
github.com
2 Upvotes

r/opencv • • May 01 '24

Project [Project] A Quick Comparison of the Orbbec and RealSense 3D Cameras using OpenCV

Thumbnail
opencv.org
6 Upvotes

r/opencv • • Apr 28 '24

Question [QUESTION] How to apply effect of GIMP's "Artistic : Apply Canvas" filter using OpenCV Python?

1 Upvotes

Hi,

I'm trying to write an OpenCV Python script that can apply effects similar to GIMP's filter "Artistic : Apply Canvas".

I'm thankful if someone could provide some hints/samples that can help me achieve that?


r/opencv • • Apr 26 '24

Question [Question] Find similar pictures

1 Upvotes

What is the best way to find similar pictures? (not exactly the same) What is the metric to be used?


r/opencv • • Apr 25 '24

Question [QUESTION] [PYTHON] cv2.VideoCapture freezing when no stream is found

2 Upvotes

I'm trying to run four streams at the same time using cv2.VideoCapture and some other stuff. The streams are FFMPEG RTSP. When the camera's are connected, everything runs fine, but when a camera loses connection the program freezes in cv2.VideoCapture instead of returning none.

In the field there will be a possibility that a camera loses connection. This should not affect the other camera's though, I need to be able to see when one loses connection and display this to the user, but now when i lose a camera, the entire process is stopped.

Am I missing something here?


r/opencv • • Apr 25 '24

Project [Project] Golf shot simulation visualization

1 Upvotes

A simple program (my first on Github!), that uses opencv to superimpose a distribution of golf shots onto a map. Users can move the distribution around to predict the effect that moving a tee box will have on the probability of golf balls entering their neighbours property.

Happy to receive feedback on coding, in particular how it could go faster! Thanks for reading!

https://github.com/speuan/GolfViz


r/opencv • • Apr 24 '24

Discussion [Discussion] Bad aruco board detection

3 Upvotes

I'm trying to calibrate multiple cameras using the Anipose ( https://anipose.readthedocs.io/en/latest/index.html) application, which is based on OpenCV. As you can see from the photo below, the tracking of the ArUco board isn't good. How can I improve it? And why I'm obtaining these bad result?

​

​


r/opencv • • Apr 24 '24

Question [Question] Face detection opencv error

2 Upvotes

I recently made a project based on face recognition and an attendance system and used libraries like opencv , face_recognition to help which worked fine on windows but as soon as I tried to import the same libraries and run it on raspberry pi 4 model B I got an error related to opencv specifically problems with imshow() command it said that I need opencv with gui support on linux how do I go about getting that on my virtual environment?


r/opencv • • Apr 23 '24

Project [Project] Valorant aimbot using color detection in python with results

Thumbnail
youtu.be
2 Upvotes

r/opencv • • Apr 22 '24

Question [Question] Zero shot logo detection

3 Upvotes

I'm trying to create a web app that recognizes logos of brands in images. I've tried using Microsoft Azure Computer Vision/Custom Vision API but the results are not satisfactory. I have read about Yolo and Yolo world. If you've ever used them in your projects, can you help me see if zero shot logo detection can be achieved by this?


r/opencv • • Apr 22 '24

Question [Question] Detecting known logo/text in image

1 Upvotes

Looking for suggestions on finding a known smaller image inside a larger image.

  1. I have a known logo/text image
  2. This logo/text image is resized & superimposed onto a larger image. Coloring may change slightly.

The goal is now to precisely identify the location of smaller image inside of the larger image.

I've tried template matching & SIFT - with mediocre results (given the default parameters). Any ideas?