![]() The delineation of individual trees in remote sensing images is an essential task in forest analysis. Remote sensing of forested landscapes can transform the speed, scale and cost of forest research.You can view EDUCBA’s recommended articles for more information. We hope that this EDUCBA information on “OpenCV rectangle” was beneficial to you. 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 # importing the class library cv2 in order perform the usage of flip () 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 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.Ĭode: # importing the class library cv2 in order perform the usage of flip () ![]() 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. thickness : The parameter represents the thickness of the border which is being drawn by the user (the rectangular shape).For examples, if the user is trying to making a blue square the following tuple has to be passed: 255, 0, 0 which makes the colour – BLUE. color : The parameter represents the colour that would be on the border line of the rectangle that is being drawn.Tuples of values are presented with respect to the rectangular coordinates (i.e., the X and the Y coordinate values). end_point : The parameter end_point represents the ending coordinates that are present in the rectangle.start_point: The parameter start_point represents the starting coordinates that are present in the rectangle.image: The parameter represents the original image that has to be processed and a rectangular shape has to be included. ![]()
0 Comments
Leave a Reply. |