It is typically useful in software for image detection, filtering and beautification such as border and frame maker and editor software. OpenCV rectangle() function is an important inbuilt function that enables to instantaneously drawing a rectangle or box around the images that are being processed by the system. # Drawing a rectangle which has blue border and a has thickness of approximately -1 px # Making use of the Open cv2.rectangle() function # The rectangular box that is being made on the input image – being defined in Black color # The coordinates are representing the top right corner of the given rectangle # Reading the provided image in the grayscale mode The final output of the above image where the image has been outlined using the rectangle function is: # Displaying the output image which has been outlined with a rectangle ![]() Image_1 = cv2.rectangle(image_1, start_point1, end_point1, color1, thickness1) # Drawing a rectangle which has blue border and a has thickness of approximately 2 px # Using the Open CV rectangle() method in order to draw a rectangle on the image file # The rectangular box that is being made on the input image – being defined for line thickness of 2 px # The rectangular box that is being made on the input image – being defined in Blue color #The coordinates are representing the top right corner of the given rectangle # Ending coordinates, here the given coordinates are (2200, 2200) # the coordinates are representing the top left corner of the given rectangle # starting coordinates, here the given coordinates are (50, 50) # the name of the window in which image is to be displayed # Reading the provided path defined image file in the default mode Path_1 = r'C:\Users\data\Desktop\edu cba logo2.png' # defining the variable which read the image path for the image to be processed # importing the class library cv2 in order perform the usage of flip () Given below examples demonstrates the utilization of the OpenCV rectangle function: Example #1Ī program written in python coding language aimed at explaining the cv2.flip() in built method. Output image which has been given an outline or rectangular shape included after the function is executed upon the original image. ![]() The thickness of the line to be made is -1 px which will fill the border or the rectangle shape by the colour which has been specified by the user. The thickness of the line is defined by the pixel size or px.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |