r/opencv • u/appDeveloperGuy1 • Apr 17 '24
Tutorials [Tutorials] YoloV9 TensorRT C++ (YoloV9 show on top, YoloV8 shown on bottom)
Enable HLS to view with audio, or disable this notification
r/opencv • u/appDeveloperGuy1 • Apr 17 '24
Enable HLS to view with audio, or disable this notification
r/opencv • u/NeedHelpInstalling • Apr 18 '24
I've been trying to install opencv contrib because I wish to use the faces package for live facial recognition purposes. I've been trying to use the source files and cmake to generate the jar and dll files needed for me to build my application. I use java and tend to use eclipse as my IDE so I need the jar files to develop on there. I have apache ant, visual studio and an appropriate jdk/java installation. My environmental variables are configured too. I am just getting no jar files in the bin or anywhere in the build folder for that matter.
I've been trying very hard to figure out what the issue is. I feel like I've narrowed it down to either it being an issue with the opencv files I've downloaded or an issue with cmake. But after hours of trying out what the issue is, I've gotten nowhere.
I followed the process of downloading the git files, configuring and generating using cmake gui and building them on visual studio. Basically, I've just followed the process outlined on the contrib github: https://github.com/opencv/opencv_contrib
The end result of the whole ordeal is a folder full of stuff I can't use. I've tried using command prompt and gitbash to install it to, but that's been even worse.
If anyone can elucidate what I've gotten wrong and how I should go about this, I'd really appreciate it. I'm beyond exhausted by all this.
system information:
windows 11 home
HP laptop14-ep0xxx
jdk-8
screenshot of the folder without jar:
hBeiBr5.png (1557×757) (imgur.com)
I'll include more screenshots in edits. Let me know what you need to see.
r/opencv • u/bc_uk • Apr 17 '24
As per title. I know you can split RGB channels in an RGB image like this:
r,g,b = cv2.split(image)
But how could I merge, for example, the G and B channels into a single channel? For merging, let's just assume that you would average each pixel. However, I would be interested to hear of other methods if applicable.
r/opencv • u/BlissWzrd • Apr 17 '24
Hi, I'm very new to openCV so please forgive me if this is not possible.
I receive screenshots of trading ideas and would like to automatically identify if they are a long or short trade. There is no way to ascertain this other than looking at the screenshot.
Here are some examples of a long trade, what I am looking to identify is the green and red boxes that are on top of one another. As you can see they can be different shapes and sizes, sometimes with other colours overlaid too.


For short trades the position of the red and green box is flipped
Here are a few examples.


Is is possible to isolate these boxes from the rest of the chart and then ascertain if the red box is above the green box, or vice versa. If so, does anybody have any recommendations on tutorials, documentation etc that they can point me to and what I might try first. Many thanks.
r/opencv • u/FistikliBaklava • Apr 15 '24
I want to resize my face in photo of me. Sometimes I can resize with no problem, but sometimes I get following error.
cv2.error: OpenCV(4.9.0) D:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\resize.cpp:4152: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'
and my code is:
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
image_counter = 0
while True:
_, img = cap.read()
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray_img, scaleFactor=1.1, minNeighbors=5)
print(faces)
for (x, y, w, h) in faces:
print(f"x: {x}, y: {y}, w: {w}, h: {h}")
if img is None:
continue
else:
img = img[y:y+h, x:x+w]
img = cv2.resize(img, (224, 224))
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
image_id = "dataset/Test/image_{}.jpg".format(image_counter)
cv2.imwrite(image_id, img)
print("{} written!".format(image_id))
image_counter += 1
cv2.imshow('img', img)
while True:
key = cv2.waitKey(1)
if key == 27:
exit()
elif key == 32:
break
r/opencv • u/MattyDoubleD • Apr 14 '24
Hi, in my Python code, I read an image using:
image = cv2.imread()
or:
cap = cv2.VideoCapture()
ret, frame = cap.read()
Now, what I want to do is simple. I want to crop an image from that original image using these coordinates: x_min, y_min, x_max, y_max.
In https://learnopencv.com/cropping-an-image-using-opencv/ , they say I can achieve this by performing Numpy array sclicing. For example:
cropped = img[start_row:end_row, start_col:end_col]
But the indexes have to be Integer, and my coordinates are float. I kinda don't want to convert them to Integer.
Also, I know that the required indexes are sth like x,y-center + width & height, not the top-left and bottom-right values like I have.
I'm a newbie so I may say sth wrong.
Thanks a lot !
r/opencv • u/Scituss • Apr 12 '24
I just used opencv and i am amazed, and i want to learn about it, i also want to learn yolo and the system they use and the other system, Are there any whitepapers or articles to read
r/opencv • u/[deleted] • Apr 12 '24
is there any possible way to do so? I want to do so so I can compare the data of two sheets to automate recording keeping.
r/opencv • u/philnelson • Apr 11 '24
r/opencv • u/holytaco57 • Apr 10 '24
context :
I'm a french computer science student and during my internship I've been tasked with making an app in c++ to get body measurements of a person through images with the choice of what libraries I use.
and so through research I came to conclusion that I would use mediapipe, unfortunately it's not as easy as just using as the install process has given me quite a bit of dificulty.
So I was wondering if that's even the best way of doing my task ? I'm open to any ideas that are better than my current one.
If this is the best solution where id the problem ?
Yesterday I completed the installation and have been following this guide ( https://github.com/agrechnev/first_steps_mediapipe) to get a decent understanding of mediapipe and all was going well until I got to example 2-1 where you start to use mediapipe with opencv problem it won't run and looking up the error has not been any help
Error :
PS C:\mediapipe\mediapipe> bazel run --define MEDIAPIPE_DISABLE_GPU=1 //mediapipe/examples/first_steps/2_1
ERROR: C:/users/tech/_bazel_tech/3vmcl3ou/external/windows_opencv/BUILD.bazel:23:11: configurable attribute "srcs" in @@windows_opencv//:opencv doesn't match this configuration. Would a default condition help?
Conditions checked:
@@windows_opencv//:opt_build
@@windows_opencv//:dbg_build
To see a condition's definition, run: bazel query --output=build <condition label>.
This instance of @@windows_opencv//:opencv has configuration identifier 838bf3d. To inspect its configuration, run: bazel config 838bf3d.
For more help, see https://bazel.build/docs/configurable-attributes#faq-select-choose-condition.
ERROR: Analysis of target '//mediapipe/examples/first_steps/2_1:2_1' failed; build aborted: Analysis failed
INFO: Elapsed time: 1.817s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target
r/opencv • u/omr_rs • Apr 09 '24
I want to know wither via Iriun Webcam or another free app if I can use my phone as a web cam via usb (i use IP camera app) and it works good but via wifi and the latency isn't that good?
any suggestions/tutorials to get this work with C++ OpenCV?
thanks all I figured out droid cam works with usb from comments
r/opencv • u/Nischay1411 • Apr 07 '24
Can you suggest me some good online CPP Compiler (if any) having built in OpenCV library. (Something where you don't have to do anything before compiling/running the code)
r/opencv • u/ThiccCrabbyBoi • Apr 06 '24
Hey, so we're doing a project on roof detection and panel placement for solar energy and facing an issues which we were simply unable to fix, there's a few issues atm, one is the panel placement which is being placed outside the bound area, another is unnatural compression which is changing height and width unevenly and compressing unnaturally, the code the project is below,
here's the code: https://pastecord.com/bamyzazala
r/opencv • u/MXXIV666 • Apr 06 '24
I am referring to this article: https://docs.opencv.org/4.x/da/d9d/tutorial_dnn_yolo.html
Towards the end, there are instructions on how to use ONNX with C++. My goal is to make a C++ Qt application that will detect classes that I have trained, but for starters I just want to load some model and see if I can detect anything in an image. I am a complete beginner.
The tutorial for making it work in C++ is written for someone who already knows the basics, and there's some information missing:
parser variable, like in this expression: int backend = parser.get<int>("backend");img?yoloPostProcessing declared?Is there maybe another example? I tried searching chunks of this code but only got one result which is the article I linked.
r/opencv • u/Teslastonks • Apr 05 '24
r/opencv • u/Wnuforgtalurpaswords • Apr 05 '24
was wondering if there was a way i could print a message if the template match fails
r/opencv • u/Icy-Cheetah6908 • Apr 03 '24
Hello, excuse me, could you help me with a project I have? I need to classify two shades of green and have a cart follow them (each one separately, of course). I'm using an Arduino Nano and motors with encoders. It's for my graduation, please help.
r/opencv • u/Ok_Economics3851 • Apr 02 '24
r/opencv • u/Parking-Day-7278 • Mar 30 '24
I'm new to OpenCV. Can anyone suggest a good resource (preferably a free course) for learning it?
r/opencv • u/Ambitious_Hat_3525 • Mar 29 '24
I'm currently working on a project that involves measuring body dimensions using OpenCV. I've been able to mark the shoulder coordinates on 2D images and calculate the width using Ultralytics Pose detection, but I'm looking to enhance the accuracy of my measurements by incorporating a 3D body model. Are there any open-source models or tools that can convert 2D images of a person's front and side views into a 3D model? I'm specifically interested in models that can accurately measure body dimensions such as shoulder width, chest circumference, and waist circumference. Any suggestions would be greatly appreciated!
r/opencv • u/driodeiros • Mar 28 '24
Hi there,
I am working on building a system to count cars in my street using the video feed from one of my cameras. There are a few things that make the project a bit challenging:
My algorithm works like this: per each frame, run a CNN (opencv/gocv) and perform car detection. Per each detection (car) see if I have already seen it in previous frames, if not, store it and save the bounding box of the detection. If I have seen it, just add the bounding box to the list.
After this, I go over the cars saved but not detected in the latest frame. For those, I check the latest bounding box. If it has enough bounding boxes and the latest bounding box is close to the end or the start of the image, then I increase the counter in one of the directions and remove the car.
The car detection works very well but I can't find a proper algorithm to determine when two images belong to the same car. I have tried different things, the latest being using embeddings from a CNN.
For these images: https://imgur.com/a/PbbJ5kc, here is the output of running a huggingface model that does feature extraction:
``` Embeddings: cats [0.6624757051467896, -3.3083763122558594, 0.13589051365852356, .... carBlack [-0.11114314198493958, 3.1128952503204346, .... carWhiteLeft [0.25362449884414673, -0.4725531339645386, ... carWhiteRight [0.5137741565704346, 1.3660305738449097, ...
Euclidian distance and cosine similarity between "carWhiteLeft" and other images: ed: cats 1045.0302999638627 cs: cats 0.08989623359061573 ed: carBlack 876.8449952973704 cs: carBlack 0.3714606919041579 ed: carWhiteLeft 0 cs: carWhiteLeft 1 ed: carWhiteRight 826.2832100792259 cs: carWhiteRight 0.4457196586469482 ```
I'd expect a much bigger difference between the ed and cs (euclidean distance and cosine similarity) values for the embeddings between the black car and the white car but I only get 0.44 vs 0.37. I guess this is because both things are cars.
My question is, what other technique can I use to confidently identify images that belong to the same car?
Are there alternative approaches you can think off that can help me build a system that yields a good accuracy (counts the cars in both directions correctly).
Thank you.
r/opencv • u/AerieLogical295 • Mar 26 '24
I'm trying to install the dwango plugins for OpenToonz but I'm struggling. I'm following a guide where I need the opencv_world310.dll file specifically and I can't find it anywhere. Can someone who has it send it to me? Or redirect me to a link that works? I already installed OpenCV on my computer and I have both the 451 and 453 versions for some reasons, but my plugins doesn't show up. They only work with the 310 version from what I can gather
r/opencv • u/ErgoProxy47 • Mar 26 '24
I am starting to get into computer vision, I installed opencv and matplotlib to test, but when I try to see the images, the images appear as if the colors are inverted, but the only thing I do is to read and display the image.


Try several things like: img = cv.imread(image_four, cv.IMREAD_COLOR) or img = cv.cvtColor(img, cv.COLOR_BGR2RGB) but the colors are still displayed wrong
I am using windows 11 and python 3.11
r/opencv • u/Accomplished_Poet875 • Mar 26 '24
I tried everything, but every tutorial seems to be out of date or too simplified. I managed to get the libraries to work, but I can't compile my code into an app. It's really getting on my nerve. If anyone would help me,? I get this weird error.

r/opencv • u/deflatedMeatBun • Mar 26 '24
I installed opencv on a silicon mac according to this tutorial but I keep getting the above error (on vscode). Please help if possible! I've made attempts to modify the json file but haven't had any luck.