RUVIDEO
Поделитесь видео 🙏

OpenCV Tutorials - Drawing Geometric Shapes with examples and code

Please watch: "OpenCV - Basic to Advanced concepts about Videos"
https://www.youtube.com/watch?v=ModiuW5ud3Q --~--
In this video you will learn about the Geometric shapes drawing with OpenCV functions like cv2.line(), cv2.circle(), cv2.rectangle(), cv2.polylines(), cv2.ellipse() and cv2.putText().

first one is drawing a line using cv2.line() function in OpenCV, the syntax for line is : cv2.line(img, (start, end), (color), thickness), where img is the black image which is created by using img = np.zeros((512,512,3), np.uint8), using this we can get the black image which is 512x512 pixels black color image, on this black image we are going to write geometric shapes. the second argument is the starting coordinates which is (0,0) it is top left corner, next argument is ending coordinates that is (511,511) - this is at bottom right corner. next argument is the color of line, here (255,0,0) it means blue color line, because in opencv color spaces are BGR mode, so first parameter in the color tuple is blue,next green and last red. you can change the color of line using these parameters. and last argument is thickness of line, here it is 5pixel.

The rectangle shape is drawn by using cv2.rectangle(img, (top_left), (right_bottom), (color), thickness), where img is the black color image,it is a canvas here, to draw a rectangle we need two coordinates first one is - top_left coordinate , here (384,0) , it means column number 384, row number 0, to bottom _left coordinate , here (510,128),it means 510 column and 128 row.next argument is color of rectangle , here color is green, and last argument is thickness of rectangle, here it is given 3pixel.

To draw a circle on the image, use cv2.circle(img, center, radius,color, thickness) function , where img is the canvas, center is (447,63) for this image, it means 447 column and 63th row taken as centre point of the circle, next argument is radius of the circle, here 63 pixels given as the radius, next argument is color of the circle, here it is red color given with (0,0,255), and lst argument is the thickness, here given -1, it means the circle is filled with the color, the dafult value is 1.

To draw an ellipse, we have to use cv2.ellipse(img, (centre),(major_axis, minor_axis), angle, ,start_angle, end_angle, (color), thickness) function, where img is the canvas, center is the location of ellipse placing, major_axis , minor_axis, color and thickness.

To draw a Polygon, we have to use cv2.polylines(img, [points], True/False, color) function, where img is the canvas, [points] are the list,it is given vertices, make those points into an array of shape ROWSx1x2, where ROWS are numbers of vertices and it should be of type int32. use this pts = np.array([10,5],[20,30],[70,20],[50,10]], np.int32) , pts = pts.reshape((-1,1,2)), cv2.polylines(img,[pts],True,(0,255,255)), 3rd argument True it means all the lines in closed, if you want open , use False, and last argument is color.

To add text to the image, use cv2.putText(img, text, (position), font, scale, (color), thickness, linetype), font=cv2.FONT_HERSHEY_SIMPLEX,Line type : cv2.LINE_AA. where text is the required text to be add to the image, position is the text placing position, font is the Hershey_simplex font, line type is anti-aliased.

the code is here: https://github.com/aiRobott/opencv-code

If you like this tutorials , please subscribe this channel for further lessons. Thanks for watching friends, signing off Kishor Kumar Vajja.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «OpenCV Tutorials - Drawing Geometric Shapes with examples and code», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.