How to detect objects in images using Opencv C# (Object Detection)
Описание
My fiverr link: https://www.fiverr.com/hamzakhalid178
contact me on hamzahumzahamzah@gmail.com for custom software's.
Please share and like the video and subscribe the channel
If any question comment below
code
var image3 = Cv2.ImRead("objects.png");
var gray = new Mat();
Cv2.CvtColor(image3, gray, ColorConversionCodes.BGR2GRAY);
var blur = new Mat();
Cv2.GaussianBlur(gray, blur, new OpenCvSharp.Size(5, 5), 0);
var canny = new Mat();
Cv2.Canny(blur, canny, 15, 120);
Cv2.Dilate(canny, canny, new Mat(), null, 3);
OpenCvSharp.Point[][] contours;
HierarchyIndex[] hierarchyIndexes;
Cv2.FindContours(canny, out contours, out hierarchyIndexes, mode: RetrievalModes.External,
method: ContourApproximationModes.ApproxSimple);
foreach(var c in contours)
{
var rect=Cv2.BoundingRect(c);
Cv2.Rectangle(image3, new OpenCvSharp.Point(rect.X, rect.Y),
new OpenCvSharp.Point(rect.X + rect.Width, rect.Y + rect.Height), Scalar.DarkRed, 2);
}
gray.Release();
canny.Release();
blur.Release();
try
{
Window.ShowImages(image3);
}
catch (Exception ex) { }
#imageprocessing #csharp #csharpproject #csharptutorial #csharpprogramming #csharpdevelopers #csharpdotnet #opencv #opencvCSharp #visualstudio #itcoresoft #objectdetection #findobject
Рекомендуемые видео








![[новый] Цена измены🌹 Криминальная Россия 2026 🌹Шокирующие и сенсационные случаи в нашей стране🌹](/images/video/2026-06-04/a6/e9/a6e9aacccdc89cedc2e8a1babb3e90ee.jpg?width=640)










