Hello, friends, my name is. Sangeeta, and welcome to my channel today. I’m going to show you how to create a image processing in c-sharp and first for that. You need to open visual. Studios, 2013 Which I have, and you need to go to the files, Go to the new create new project and over here. You need your windows form, so make sure you click on windows form and give a name. Whatever name you want to give a little to work with whatever you’re doing, We are going to work on image processing, so let’s write just image processing and this is the directory where all the project will be saved on for me. This is fine! If you want to save your file some other directory, then you can stick into whenever you want so over here. This is a form you can resize the form of it. How long you want to not shot? You want to hit offense upon you? And this is the form right, Click on the form. Go to the properties over here. The text unique. You can change to whatever you want. You can write your main program. I am just going to add image processing over here. It will change the name, and if we go to the down. There is a design in the design, the name, the actual name. Vitaphone the name is form 1 and, yeah, I’m not going to change it until it’s bothering me so over here Since we are working on images we need to. Oh, we need to have a picture box on the left hand side. There must be a tool box or over here. View tool box. You can open the tool box if you want. Oh, so here, so we’re here at a picture box left on that and you can select. How big you want? How small you want, right, Click on that go to properties and over here in the design part. I’m going to change. The name has brick original since I want to show you guys the original picture and the modified picture, So I would need to picture box for that. I’m simply gonna copy and paste on next to it to show the difference between the two and change the name again. Go to the properties in the design. Part, the Pacini would be result, Click result. And that’s it and over here. I would need button to show the clicks to that. I can. I will chair right here. Open, right, click on that. Go to properties again. The name, the design part BTN open and the text would be this text over here. The text would be. I would just write open since I wanted to make the thing very user friendly, so other people can understand what you’re trying to do and again, copy paste and over here I will write first are in first image posting. I’m going to show you how to convert an image into a grey, so I’ll just write over here. Ray and BT in the design pot BTN way, Okay, that’s it. Everything is all set now. We just need to work on at life. We need to give programs so first, let’s start with the. Open button. Double click on that so over here. We have clicked on the open button and we need to write a code in that so over here. I’m going to open our dialog box, so Open File dialog. Give any name objective names, so I will drive over file, and that’s what we gave the name and this is the object of the fire, and we need to give a filter. So, Oh, file dot voter swings. We only need add the images just the images, so we need to write over here image file. We need a bitmap format or any jpg format. We just need these format, so we have to admission over here, okay, and let’s open the dialog box equal equal to in the Donald Lien file Talk-show dialogue. Okay, and it’s lit and over here, we can write the code which we want to do, and so I will write this dot back original dot image, so I need to set their picture box image as their new image we have selected so by default. All the picture box will take only bit format one, so just just for the safe side. I’m converting the image into the bitmap if it is JRG JPG format. So over here, I will write the file file name and this will take the picture from that, and I will just for the safe side. Yeah, that’s it and control this and let’s run and see if it is working or not over here. I’ll click open. Yes, it is taking all. The picture emerges like image files that whatever we gave and we hope we always need to do like right first gold. Run it and see at that time, and it shouldn’t be like this that if we write a plenty line of codes. And then you run and see now every time you write a code. Just just make sure that if it is very, have you done anything wrong? Because otherwise it will become a complete mess, so let’s go forward and there, so we have taken a picture from that a dialog box and put it into the picture picture box, and now we have to convert into Ab Dre, so we’re here. We need to write some code, which will convert an image into the great weight. So if you want, you can write the code over here about the proper way to do, It is is writing all the code inside a different class, so I’m going to click on this project and go to the add select new item and over here. You just need a class, so over here, you can write whatever you want to write, which is appropriate. I’m just going to write processing and dot C. Yes, that’s it, and this will create a class for me first. I will create by default, the arm, the constructor for that for that class that is processing. I won’t write anything it just like just to be sure in public static. -, it will take a bit not to be. Oh, it’s not taping, so whenever you forget to write any namespace or anything like that, just right. Click on that go to resume, So I have not written this so it will automatically show me what I need to write, so we here. I’ve created a static function and over here I will write The Bitmap is image which I will take from the picture box. So yeah, so first is the width and the height. We have to calculate from that, so we here. I will write integer and equal to this lingo and always comes read first and then height. Cheeta, so blood or height and I shape the space. Okay, sounds good to me now and over here. We have to write all the things which we want now first. I will take a color, just one color and over here. I will set the pixel. I mean, I will. I will take that bit matte and get the pixel get pixel. I comma J. And now I will take from that color from this color. I will take a RGB. I can write R equal to C 1 DOT R. Oh, I have to write a 1 over here and G 1 equal to C 1 DOT G Nice RGB. And once it is taken, the are integers from that color, and now I have to calculate the gray part. So how are you going to calculate an Internet? You will see many. Um, many formulas for the gray. It totally depends upon you home. Even how you gonna write this if you want to change the? Uh, the point point point. Three zero five. You can do whatever you want. I’m gonna just follow the regular regular. Uh, Matt, for degree so Omega. I’m gonna take all the some of things are JP. It is Chi one, right and point one one for V one. And once the gray is ready now we have to take all the are all the RGB and give the value of gray No G 1 equal to a and B 1 equal to three. Yeah, sounds good, so over now we have to set the pixel set the pixel for that bitmap. So we here be dots set pixel. I comma J over here. We need to give a color so over here. I’m gonna write like color dot from RGB. That is average RVT, and after give the value r1 comma G 1 comma D 1 Oh, so this is done and now we have to return true. Okay, see, the red mark is gone once. I wrote this because it is it. It takes pool that is true or false. You have to return something. That is why it was given that Red Mark. Now it’s all gone Ctrl S and let just build the solution. See if there is any wrong, Nothing is wrong, so over here. We need to go to their property. You know, to the design and click on green lets. See what happens after clicking on between and it will take us to their egg. Wait, click event. So we share just for the safe side. I’m gonna do an try catch. Holy, you don’t need it. I mean, it totally depends upon you if you wanted to right so now first. I have to take a new bitmap. Oh, Oh, P equals a new bitmap and why I am creating a new bitmap is that I have to take the copy of the pic. Original picture box have to take that thing and convert into a bitmap. So I will take this This dot vector, which no dot image. So that’s fun with this one. Okay, and I have to go to processing class dot and watch it. Okay, can would Gray have to give one bitmap beside Bitmap image? I’ve given to this, and now I will select that with some image equal to copy. Okay, so let’s save everything and and stop the program so first, open the image and take the image, which is showing the image file the JPG format first, and so the picture box is taking the JPG format and and it is converting first into a bitmap and then it’s taking the image, so now convert the image into a great. Let’s click on this so it is being converted and through this through this class. This code is running and calculating all day. RGB and giving us this image. So this is how you do it. You can also like do you can add the negative. You can create an image, negative image of an image and you can do further on and in the next video. I’m going to show you how to do and how to improve in this. So thank you for watching.