The Easiest Way To Do Object Detection in C#
Ғылым және технология
In this series, I will be taking you through an introductory tour of OpenCV and Emgu (the OpenCV C# Wrapper)!
In this video, I show you how to do Object Detection in C# with Haar Cascade Classifiers and the YOLO Object Detection Algorithm! This version of detecting objects in an image works much better than template matching, and you can do some pretty crazy stuff with these two algorithms.
OpenCV has been one of my favorite libraries to tinker with, where you can do some impressive things such as facial recognition, image manipulations and filters, video processing, and much more! So I wanted to introduce fellow programmers to it, so you can have as much fun as I’ve had over the years.
🔴 Link to the Playlist, in case you need to catch up -
• Introduction to OpenCV
🔴 Download Source Code used in the OpenCV Series Here!
bit.ly/3P3zXoy
🔴 I Started A Programming Resources Newsletter! Expect Good Resources on Your Learning Journey Each Week! - programmingwithchris.substack...
🔴 Subscribe For More Programming Tutorials
bit.ly/3NN23DB
☕️Buy me a coffee if you enjoy the free content! -
bit.ly/3Pw56Sf
🕘Timestamps:
0:00 - Video Start
00:51 - The Haar Cascade Classifier Code
05:39 - Haar Cascade Classifier Demo
06:49 - The YOLO Object Detection Algorithm in C#
27:31 - YOLO Object Detection Demo
Thanks for watching! I plan on making a ton more tutorial programming videos on libraries I find interesting, and if that’s your sort of thing, check out my other videos and subscribe for more. Thanks!
🎬Watch My most recent videos:
bit.ly/3yJwaY5
Пікірлер: 34
Thanks for watching! If you have anything else in the OpenCV library that you'd like to see done in C#, please let me know! 🕘Timestamps: 0:00 - Video Start 00:51 - The Haar Cascade Classifier Code 05:39 - Haar Cascade Classifier Demo 06:49 - The YOLO Object Detection Algorithm in C# 27:31 - YOLO Object Detection Demo
This is really cool. Would be cool to use OpenCV to do apriltag detection and tracking. You could even have the apriltags read different colors (a red code, a blue code, a green code) and then based off of the template you could draw the correct color around the object as you're tracking it.
This is educational 😍
Hi, thanks for this great tutorial. I am currently trying out to run inference from an ONNX model, and I seem to have problems finding a way to unwrap the VectorOfMat that is returned after running a forward pass. Is there any documentations on unwrapping?
I am planning to build a software that can help blinds to detect objects and faces, to what extent this can be helpful? or I should think of different library/language/framework?
how are you setting your camera to be in source for the analysis? I think I missed that step somewhere. Great vid!
objection detection is pretty powerful.When combined with a box around the target, (simple logic "like when box A meets box B" do something) for example object A is a beer glass object B is the table when A rectangle intersects B rectangle order another beer.
@s1mplename
13 күн бұрын
why tho. whats ur point
You make it look easy😂
how would I get the name from of the detected object and store it in a value. Thanks.
Wauww nice content! Can you make a video showing YOLOv6 or 7 working with C#?
how to capture image and detect ? I don't want detect when wedcam run live stream?
hi chris, great video but i still have some questions in emgucv. i am having some troubles when i try to train custom model for detection. emgucv gives me error "number of input channels should be multiple of 3 but got 256" etc. i still don't get how to set the inputs for cnn individually(emgucv mat and arrays are really confusing since you dont know how they are laid in the memory, documentation does not help either). for example, how can i pass an image to the cnn if the layer inputs are different than shown here?
@ProgrammingWithChris
Жыл бұрын
Yeah, that's an issue I ran into as well, I believe. At least, my problem was the net.Forward was expecting a very specific dimension on the input. If your issue is similar to the one I'm thinking of, I'd recommend playing with the .Resize of the frame, even just manually putting the pixel values in the System.Drawing.Size() parameter to it so that you guarantee that it's a multiple of 3 (just have to do some math there). If that doesn't help, let me know and maybe point me to some code so I can take a look.
Is it possible in plate number? Using c#? What is best to use haar classifier or yolo? Thanks
Hi Chris, really helpful and great tutorial! I have errors on the first line with var net = Emgu.Cv.Dnn.. when I try to run the program: System.TypeInitializationException: 'The type initializer for 'Emgu.CV.Dnn.DnnInvoke' threw an exception.' And: DllNotFoundException: Unable to load DLL 'cvextern' or one of its dependencies: The specified module could not be found. Is there any chance you can help?
@abbeykirkman397
11 ай бұрын
did you fine the solution to this?
@digitarts6085
6 ай бұрын
@@abbeykirkman397 I had same problem, but I was able to solve it by installing Emgu.cv.runtime.windows to project.
Hi Chris, I tried to run the source code for the YOLO example and I added those 4 files to my project file but I get the error: An unhandled exception of type 'Emgu.CV.Util.CvException' occurred in Emgu.CV.Platform.NetStandard.dll Additional information: OpenCV: Failed to parse NetParameter file: ./detection/yolov3.cfg. This happens by the first line var net = Emgu.CV.Dnn...etc. Do you possibly know how to solve this problem? Am I putting those files in the wrong place?
@ProgrammingWithChris
Жыл бұрын
Are the files in a folder inside of your project called /detection/ ? if not, you'll just have to adjust to point it to the right location.
@digitarts6085
6 ай бұрын
I had same problem, but I was able to solve it by installing Emgu.cv.runtime.windows to project.
Helo, how to Object Tracking on C#?
Hi, do you think that it could be used to capture all the chess pieces and their location, and then return their positions in 2d array representation of chess board ?
@kerverse
11 ай бұрын
Any updates? Ive been working on a similar project and dont have any leads at the moment
@GR4MPI
11 ай бұрын
@@kerverse Hi, no updates, sorry. I planned to make it as bachelor project, but later i changed my plan from getting chess locations from camera feed to making some sort of fps game in unity... I know its lame, but much easier :)
@s1mplename
13 күн бұрын
@@GR4MPI well you could make a sort of detection using a color based analysis. though you would need to really work on a project and create a tech from scratch
@GR4MPI
13 күн бұрын
@@s1mplename yes.. i did my research and decidedd not to go this way :)
@s1mplename
13 күн бұрын
@@GR4MPI i was tasked with a project about a new type of age detection. Im still pondering about how to make it. Its tooo hard 😭
can you also do tutorial on manual train a model and then add that to project
I get this error : Emgu.CV.Util.CvException: 'OpenCV: Transpose the weights (except for convolutional) is not implemented'
@Lot10Games
5 ай бұрын
yolov3.weights is 2Kb LOL. It's corrupted or something . I downloaded from other source and it works.
Can u do "The Easiest " code in 10-15lines to demonstrange to how EASY start. no those things. omg. BE SIMPLE DUDE! there mose ppls who cant/dont want read documentation.