C# - Real-time Object Detection From an Image | Yolo - II | Draw Rectange and Text on the Image

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to part two of my object detection using tesha tutorial in this session I will show you how to display the detected object in the image like this see in part 1 we get the details of all the objects in our image now in this session I am going to show you how to display this square and how to add this particular text into our image okay let's start [Music] in order to render all the details about the object in the image I will create one method that is add details method okay boy - picture box and then here I will receive 2 arguments 1st argument is the picture box reference picture box picture box to render and my second argument is the list of you know items ok but right now this list is showing error so I want the import system that collection dot J click ok so I will choose that option ok it is of the type yellow items ok we want to import the necessary using statement so we use using address dot 0 dot model okay there has been card here I want to write a logic to display all this items to this picture box image so here I will call this particular method so call this thing and then the first argument is our picture box reference so I use the BAC image that is our picture box name so I will pass that picture box as the first document and the second argument is of type list of yellow item so here we already collect the list of your local items so I will just pause the reference of that items here and remove this break point and then here I want to write a logic to add all the objects that is there in these items to this particular picture box image ok so our first step is to fetch image from our picture box and then store that image in a separate reference ok sorry is where bitmap sequel to picture to render pizza box to render door image it gets the image that is there another picture box and then now I want to get the graphics from the image this graphics is used to draw a circle and to display the text on our image okay so graphics dot image to that we want to pass this bitmap okay this bitmap is actually not the correct name so I will change this bitmap to image because it is not effect bitmap but it is of type image so news I dmg okay and then I will collect its yourself in the graphics okay now we want to iterate through all objects that is there in this items and then the first step I want to enact the square the draft the object okay so I will use before loop to iterate through these items okay so use for each for each where item in items and then here I will fit all the necessary details like the x axis and y axis the height and width of the object okay so where X equal to item this item is the individual object in the image because this items contain all the objects that is there in our image so we are iterating through it and then during the each iteration we will get this reference of each item that is there in our image so I will get its x axis y axis and its height and width okay so there are ways you can do item dot Y width is equal to item dot bit signal where height is equal to I cannot hide okay we get all the necessary parts to draw a rectangle on our image okay so use we're seeking to rectangle and then here I will pause x-axis y-axis and its width and height height so these are the x-axis and y-axis and the width and height of the particular item that is there in our in it will create a rectangle of this particular size okay and then right now this rectangle doesn't have outlined okay so what I want to do is I want to create a pin so 10 is equal to new here I want to pass the color and the pixel so color dot i will choose light green okay as the color of the pen and this second argument is the width of the line okay I will choose six okay six and I will graphics dot and then here as the first argument I want to post it there and then the second argument is the rectangle okay that's all I will run my application once again browse choose this image detect okay but it is not actually displaying any rectangle over this pathetic okay average my core okay we missed one part that is storing the bitmap I came through the picture box so what I will do is picture box to render us anything so it box to render the image signal to you may IMG because we edited the graphics of this IMG only see we edited the graphics of this IMG okay now I will run this program once again we just maximize the window browse and then we choose this picture a tactic okay now it is working see you can able to see this particular rectangle over this object okay my program is working fine now only one part is left that is displaying the type of the object in this center of this rectangle okay that is very simple believe that is very simple okay in order to do that what we want to do is we want to get few properties to actually draw a string okay they are fond so reset for to sort of first thing is the font type I will set area and then the second argument is this size so which is 50 then the third is constant so font style dot okay will set both okay we set up the font I then we want to set up tip brush using that brush only it will draw the text on the image by a sequel to solid brush it has the color of line green we will go with the color of our now I will just give one thing here graphics dot draw screen and then the first argument is the string to display so here the string to display is the type of the item so we can use item dot type and then the second argument is font third argument is brush and then the final argument is the conic but we haven't created any point object so what I will do is inside this for loop I will create the point because we want the x axis and y axis of the item to actually display the text so we'll use that point it's equal to new point of here I want to pass the x-axis and y-axis so use this x and y and then I will pass that point as the final argument to this drawstring method okay that so now I will run my project browse and now I will choose this bird the tag see it is actually displaying the rectangle along the type of that object see it is a five bird okay now our program is working fine but it has one small but you can't actually find that but in this image so we choose another one image okay did that okay see here there are two objects it actually detects to object the first object is this person object see the person is not actually displayed in the center of this rectangle but it displays in the starting of this rectangle similarly this TV monitor also it gets displayed in the starting point of this object okay so what I want to do is I want to Center this text both horizontally and vertically okay so the logic simple that is we want to do Express from the X we want to go to its half so what we want to pass is Express wait it will actually move the text to the rightmost side but we don't want that they want to move this point to go to the middle so I will do with by two that will prevent this x-axis to go to the rightmost thing and then it will stay in the middle most part okay horizontally and then the second part is weightless height similarly it will also move the y-axis to the bottommost point of the image I don't want this to happen I want this y-axis to be there in the center of the rectangle so I will do height by two so using this logic we can able to Center the text now I will run this project once again I will maximize this window I will browse for the image now I will choose this particular thumbnail this is the thumbnail of my G map dotnet video see now it actually displays the rectangle I can see this text actually starts from this center of this rectangle okay so I will browse another image and then I will show it to you detect see this text actually stays Center both horizontally and vertically similarly if this thing also stays Center both horizontally and vertically that's all for this session if you have any queries please let me know in the comment section suppose if you want my personal health or your project needs you can reach me through main ok meet you soon in one of my another video thank you and goodbye [Music] you
Info
Channel: Balaji S
Views: 11,913
Rating: undefined out of 5
Keywords: object detection, yolo, yolo object detection, yolo object detection code, yolo detection, yolo object detection github, yolo object detection python, yolo object detection tutorial, yolo object detection algorithm, yolo object detection tensorflow, real time object detection, image detection, how to use yolo object detection, how yolo object detection works, object detection yolo, raspberry pi yolo object detection, yolo v3, c#, opencv, opencv object detection, balaji
Id: w93g6yAOuNE
Channel Id: undefined
Length: 13min 13sec (793 seconds)
Published: Sun Feb 03 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.