Opencv contour area pixel count. countNonZero to count how many of them there are.
Opencv contour area pixel count. FILLED) sigle_green_line = cv.
Opencv contour area pixel count Jan 4, 2020 · Here is one way to do that in Python/OpenCV. 1. area < 500 { contour. drawContours(img, contours, -1, (0, 0, 1), -1) you can plot all the contours. 1 Operating System / Platform => Windows 64 Bit Compiler => 3. To find the different features of contours, like area, perimeter, centroid, bounding box etc; You will see plenty of functions related to contours. As we know that each pixel in a coloured image ranges from [0-255] all-inclusive, the pixel value for the black color being 0 and that for the white color is 255. All the things I'm trying to do are: get each contour area and check if selected contour is in specific color range or not. I am now attempting to use OpenCV and the floodfill method to count the number of pixels inside the curve and then I will later convert that to an area given the area that a single pixel encloses on the plot. drawContours(mask, [contour], 0, 255, cv. sum to obtain the total number of pixels. Check out the wikipedia page on Image Moments Mar 14, 2014 · However, when I calculate the area of this contour (using the function contourArea), I get 157, which is too low for the size of that contour. Code: 3 days ago · To find the different features of contours, like area, perimeter, centroid, bounding box etc; You will see plenty of functions related to contours. at(4); Jun 23, 2020 · I am using cv2's arclength and contourarea in my python project. Many OpenCV functions can use a mask. Is there a way to get it to draw contours around the pixels? Here the same problem is encountered three years ago. Each of this elements in the vector is no more than a list of Points that contain the (x,y) coordinates of each pixel in the outer contour of the blob. Mar 11, 2015 · OpenCV Python count pixels. 1; Operating System / Platform => Windows 64 Bit; Compiler => 3. Results are also same, but with a slight difference. So, I want the output becomes examplearray = [sum the number of pixel in right box, sum the number of pixel in left box] Aug 19, 2015 · contourArea unit is pixel. Object recognition by edge (or corners) matching ? How to extract only top-level contours? Wrong Position From cvGoodFeaturesToTrack()! Jul 17, 2014 · I have 2 contours and I want to compare how much the same are they, as the ratio of the area_of_c1/area_of_intersection and area_of_c2/area_of_intersection. Apr 20, 2012 · Without Canny() preprocessing, you will get contours of objects. If I have a 2-pixels wide square, the output should be 4 (cv::contourArea outputs 1), and so on. Aug 22, 2013 · You can use the function cv::countNonZero to count the number of black pixels. zeros_like(mask1) cv. Similarly to moments, the area is computed using the Green formula. – user1196549 Apr 20, 2015 · I used the LAB color space because I don't like finding red in HSV since red wraps around from 0 to 180. The height for a specific contour will be h and the width will be w. That's trivial case. If you actually want the black & white pixels of the binary image 'gray', then you need to replace . RETR_TREE in findContours was completely arbitrary, feel free to use a different param if you want to use a different hierarchy. Find bounding Rect for each contour. Feb 24, 2015 · When we want to find the contours of a given image according to a certain threshold, we use the function cv2. Why is that ? Isn't should be '1'? And result is same with using moments. Mar 21, 2023 · Now that we have a basic understanding of contours and their importance, let’s explore how OpenCV handles contour detection. Thus, the returned area and the number of non-zero pixels, if you draw the contour using drawContours or fillPoly, can be different. Which is more efficient, use contourArea() or count number of ROI non-zero pixels? Tricky image segmentation in Python. I have done in a way of creating 2 convex contours and 2 Mats of zeros and fill them with fillConvexPoly() and doing a bitwise_and() between the two Mats for getting the intersection. Here is some demo-code and an Nice, it is working, and it is working very nice. If you just need to access the pixels, you can iterate through each pixel in the contour's bounding rect roi but only use the ones that are "on" (non-zero) in the Jun 7, 2013 · I am working with image contour detection. 7. Mar 24, 2016 · To get its area, OpenCv provided the function for you (How did it find that it's the largest?) so here is the function: double cv::contourArea(InputArray contour) Here is the main page because I think you can send the contour as it is but I am not sure but check this basic example and : Jan 10, 2025 · Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image. How to resize a contour? Area of a single pixel object in OpenCV. Now draw this contour on the mask image filled with white color. Things can be more complicated if your scale is not linear : pixel near center haven't got same surface than pixel far from center. shape context Aug 5, 2016 · Have you checked docs?This is stated: The function computes a contour area. In some applications, where pixels have considerable size in real life, e. OpenCV provides the findContours() function to detect contours in a binary image. But I do not need the area of the contours. vector<Point> contour = contours[i]; double area0 = contourArea(contour); this contourArea() is the number of non-zero pixels Find contours; Count all non zero pixels; After finding the contour shape, you can use cv2. To verify the results I've applied both functions to a discretized circle with r=100. I was thinking if I could calculate individual shapes area (connected white pixels) in the imag Jul 30, 2016 · Consequently, I perform cv::findContours, storing all the contours points coordinates in a vector < vector < Point > > . Nov 24, 2022 · In a picture i find two contours among each other which look like this: I use cv. Then, for each image, compute the descriptors and use the trained SVM to get the answer for each pixel. But the code seems really complex and not readily understandable. remove(i) } Apr 7, 2020 · When I run my function, I get this result Contour[0] Area: 221, Length: 70, Colour: Red Contour[1] Area: 13772, Length: 480, Colour: Green Contour[2] Area: 150, Length: 2370, Colour: Blue While I havent actually counted the area of the left part, It seems as if it encompasses much more than 149 pixels and would certainly have a higher value Apr 27, 2015 · So I'm trying to write a function, lets call it foo, that takes the path of a binary image, gets the Hough lines along it and then returns the lines sorted by how many white pixels are along the Ho Nov 9, 2022 · Hello, i have a picture where i can easily find contours in. Continue the the process for next contour. jpg Jul 15, 2018 · For each labelized pixel, get the features for that pixel. OpenCV Python count pixels. Aug 23, 2022 · I went through the opencv-python documentation for the method cv2. For each i-th contour contours[i] , the elements hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. Dec 2, 2019 · Update: You can use contour area filtering to achieve your desired result. Calculate the minimum area rectangle, find all the points inside the rectangle using transformation, and find average of points that are Jul 3, 2012 · I am trying to count the number of non-zero pixels in a contour retrieved from a Canny edged image using openCV (using C). 3) cut the image from contour. – cyberdecker Commented Nov 14, 2012 at 11:16 Jan 4, 2023 · This sum() function can be used to count the number of pixels on the basis of the required criteria. I need the number of ''white blob'' in the image (post noise-removal - they are objects. Maybe i can even calculate height (y-direction) for every pixel in x-direction and display the minimum and maximum height? So far i havent found a solution Dec 25, 2022 · Now I am trying to get each contour color and write condition for example: if contours[0] in color range ((100,100,100),(200,200,200)) then drawContour. You can then mutiply area by your scale to have area in mm2. Contents. OpenCV only supports recta Jan 16, 2021 · So far, I have tried to use both the alphashape and polygon methods to acheive this, but both have failed. Dec 5, 2024 · Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image. I'm also assuming that you know the index of the contour that was used to surround the object you want. I thought it would be a good idea to get the coordinates of the edges (number of edges change form object to object) or to get all coordinates of the contour and then use contourArea() to calculate the area of my object. Every region has its own numeric integer value. contourArea() gives area different to pixel count, since it considers the contour ideal that is without an area. I am using cvFindNextContour to find the subsequent contour retrieved usin. Image moments help you to calculate some features like center of mass of the object, area of the object etc. Similarity, you can also use area to define a threshold to eliminate small objects, as OpenCV tutorial shown. 1; Detailed description. OpenCV built in functionalities does not contain subpixel edge extraction methods. Which is more efficient, use contourArea() or count number of ROI non-zero pixels? How do I draw irregular contours of MSER regions. It will be most probably a large white blob, obviously not letters. Contour detection in OpenCV. int0(box) Cx = rect[0][0] Cy = rect[0][1] # Make a mask of this single green line mask = np. Now, a bit of knowledge of the pixel patterns comes into the picture. For other values, you can create a mask using cv2. When I find the contour, its location is returned. OTSU_THRESHOLD to find them with cv. The function identifies contours by analyzing the image’s pixel intensity, connecting adjacent white Jun 20, 2020 · In order to find the area of each contour, you can loop through the number of detected contour and use the function cv::contourArea() on each of those array of image coordinates. satellite applications, this matters. Moments Now to select the next contour, or next coin, use contour = contour. Drawing contours using CHAIN Feb 10, 2020 · To obtain the height and width of a contour, you can use cv2. Get the user selection as a contour then draw it as filled in a separate blank image. MORPH_CLOSE. You will have to find it yourself). I need to find the sum (not area) of the pixel values in the contour. Aug 10, 2021 · I’m trying to use OpenCV for the first time to try and find the contours of several regions in a labelmap. OpenCV => 3. 4) sum individual channels and divide them by number of pixels in it ( or with mean function) Jan 24, 2012 · I try to use checkContour() function in new python api (cv2) and it do works if I create contours to be checked using findContours e. May 3, 2020 · System information (version) OpenCV => 3. Jun 4, 2019 · This answer looks at all the green bars in the image. In order to find the area of the contour in the red circle, you can introduce a check inside the loop if the median points of selected contour falls inside the circle Jun 16, 2017 · Use this to convert Grayscale masks to Rectangles. Some pixel precise edges extracted using the built-in cv::canny and cv::findContours operators are as illustrated below: Pixel precise edge contours of circular marks. 5 and etc and confuse. I noticed that the number of pixels (Points) in this structure is greater than the number of pixels I get by computing vector<point> white_pixels; findNonZero(silhouette, white_pixels); on the same image. Here is my code in I need to calculate the area of a blob/an object in a grayscale picture (loading it as Mat, not as IplImage) using OpenCV. Read the basemap image as grayscale and threshold; Read the map image; Get all the contours from the thresholded baseman image Apr 2, 2019 · The function computes a contour area. May 13, 2015 · contours – Detected contours. Similarly to moments() , the area is computed using the Green formula. Sometimes it selects the area of white pixels surrounding the black pixels, e. of black to white pixels in the image using OpenCV. in this figure the "g", "e", and "n" are selected with black pixels as I expect, but the other three letters are selected by the surrounding area of white pixels, as shown by the Feb 27, 2015 · Masking out the information. This appears to happen when the contour is not closed. Feb 11, 2017 · Area of a single pixel object in OpenCV. Jan 8, 2013 · Prev Tutorial: Contours : Getting Started. Numpy gives coordinates in **(row, column)** format, while OpenCV gives coordinates in **(x,y)** format. I can easily print the contour coordinates but I am interested in printing the coordinates of all the pixels inside the contour. Here is the concept: background subtraction > Thresholding > canny > findcontour > sum the white pixel in each contour and make them to array list. 3. If it is true, the function returns a signed area value, depending on the contour orientation (clockwise or counter-clockwise). In this image there is a red bounding box at the center. 2 on Visual 4 days ago · Calculates the up-right bounding rectangle of a point set or non-zero pixels of gray-scale image. contours, hierarchy = cv2. The using cv2. The vector<Point>(inside) is the coordinates of a contour, and every contour is stored in a vector. To do this, my approach is simple: 1 - Find contour of the first image, and then find the area of the contour 2 - Find contour of the second image, and then find the area of the contour 3 - Find the contour of the Apr 17, 2015 · On a recent set of images, my OpenCV code stopped finding the correct area of a contour. Goal . for contour in contours: rect = cv. For instance, if the area of a contour is 32. Extent. pixel intensities below 220 are considered as 0 (black pixels Apr 22, 2012 · Now find contours in the threshold image. If you want to measure area, don’t use the contour functionality. matman ( 2015-04-20 13:59:09 -0600 ) edit Jul 3, 2012 · In a case were you only want relative areas, which one is faster to compute: calculate a contour area - contourArea() - or count the number of ROI non-zero pixels? You can assume the contours have been found and you have everything needed to do either case. contourArea(). 0. 6. See next two images: First image i would like to extract all black pixels inside the hallow shape because it's traped/surrounded by white, but image 2 have a opeing and in that case i don't need the pixels. Now im wondering whether i can also calculate the height of the contour at different positions. This will give allow you to directly count the number of pixels within segment by using contourArea function. Use cvFillPoly to create a binary mask of the polygon, then use cvCopy to make a copy of the image using the mask created to a whited out array, thus the only black pixels are those that were in the polygon. Which is more efficient, use contourArea() or count number of ROI non-zero pixels? What's the best way to segment different coloured blobs? Tricky image segmentation in Python. Then Sep 19, 2019 · I'd like to count the number of pixels with the value=[0,100,234] in an image. Jan 8, 2013 · Here, two methods, one using Numpy functions, next one using OpenCV function (last commented line) are given to do the same. I think there is no in-built function to return the number of contours, except you iterate through the contours and count it. boundingRect. I dont know about your other images. Thus, the returned area and the number of non-zero pixels, if you draw the contour using drawContours() or fillPoly() , can be different. I am currently creating a new grayscale and then using the function cvDrawContours to fill in the contours pixels in the grayscale. Find contour. Oct 17, 2020 · I would go like this. Area of a single pixel object in OpenCV. Is it possible to count the pixels inside the red box using OpenCS? given that the image is 1024x768 in dimension. The last -1 denotes that the entire contour needs to be filled. multiply two points and matrix. I thought area is number of pixels that comprises that contour. Extent is the ratio of contour area to bounding rectangle Apr 18, 2020 · This polygon is smaller than the set of pixels, each edge is moved inwards by half a pixel distance. Use the color info may help, I analysis it in RGB and HSV like this: Jun 24, 2011 · vector<Point2f> originalPoints; // Your original points vector<Point2f> convexHull; // Convex hull points vector<Point2f> contour; // Convex hull contour points double epsilon = 0. CC_STAT_AREA Apr 9, 2015 · Now I know enough of OpenCV to know there's eroding and dilating, but it seems like the best approach would be to exclude contours whose area is below a certain pixel count, however I don't know how to integrate the contourArea() function into my code such that it would work. RETR_LIS Aug 26, 2022 · You can create a black image of the same size as the original image. def mask_to_rect(image): ''' Give rectangle cordinates according to the mask image Params: image : (numpy. This is consistent with the area of a 2x2 pixel block being measured as 1 pixel. I have tried to ensure the contour is closed to no av Jul 3, 2012 · In a case were you only want relative areas, which one is faster to compute: calculate a contour area - contourArea() - or count the number of ROI non-zero pixels? You can assume the contours have been found and you have everything needed to do either case. (Remember, this area is particular for this image. Extent is the ratio of contour area to bounding rectangle Jun 18, 2013 · My initial solution consisted of finding contours for this image, and fitting a closed convex polygon around each contour, by finding the convex hull of the points in each contour. boxPoints(rect) box = np. Scan the whole bounding rect and check the non-zero pixel count greater than the threshold, if so draw the rectangle. However it seems the contours are drawn from the pixel-centers instead of around the pixels. 1) Contour area - is it means the area inside a close loop? Must it close contour? 2) what is the unit of the contour? I obtained result as 1, 7. I will use whatever is best for the actual problem. minAreaRect(contour) box = cv. Suppose I have an image (1024x768). One easy (but inefficient) solution would be to use cv::drawContour and count the number of non-zero pixels. Next, I loop through contours min area rectangle pixels skipping the pixels which are not filled in with the grayscale. Tricky image segmentation in Python. Now you use just sum the whole image using np. countNonZero(mat). But i need some clarification. Mar 7, 2024 · Finding contours with OpenCV is quite easy to implement and use, yet it is very powerful way to detect objects in some cases . Also, the function will most certainly give a wrong results for contours with self-intersections. h_next() and so on. 4. May 4, 2017 · Returns: the binary image with small objects removed """ # Find all connected components (called here "labels") num_labels, labels, stats, centroids = cv2. findContours(gray, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE); Jul 15, 2017 · I propose an alternative to the accepted answer: instead of counting pixels inside a bounding rectangle, paint the contour into a mask, then mask the original image and count the pixels inside it. Moments. Area accuracy is given by perimeter I think : AREA = CONTOURAREA +/- ARCLENGTH. Using Open CV with a Network IP Camera. Nov 13, 2012 · Everything will be black or white after the thresholding, so the cvContourArea will calculate the area for each contour (that include the white pixels). So for instance, to know the 5-th vector, it's vector<Point> fifthcontour = contours. The function returns the contour information in the form of x,y,w,h. If your image only contains black and white pixels, the number of white pixels will be: (image_width * image_height) - black_pixel_count Oct 30, 2014 · Largest enclosed area. Example image: testplot. 0, how does it translate to the number of pixels in the image (width or height)? How can I iterate through a list of contours and remove any contours that don't have an area of at least n? if contour(i). I was counting black pixels on a white background, where the contour kept several pixels on the edge, so your mileage may vary. Assuming you ran cv2. Similarly to moments , the area is computed using the Green formula. And i am also able to put a minAreaRect around it and display its width and height. With in bounding Rect set ROI with your small box size and count non zero pixel. I expect it to be in the thousands. More, your idea of resizing the mask is introducing errors, because the cv::fillPoly is introducing errors (small "stairs") and resizing it is just making the errors to appear in the new contour, and they are even bigger. connectedComponentsWithStats( img, connectivity=connectivity) # check size of all connected components (area in pixels) for i in range(num_labels): label_size = stats[i, cv2. Count total number of white pixels in an image. Filter the contour for area between 500 to 5000. 92. But as far as I know, the cv::contourArea is just an approximation. Jul 31, 2019 · Hello. From documentation of contourArea in OpenCV, "The function computes a contour area. Mar 25, 2015 · For instance, if I have a single-pixel contour, the output should be 1 (cv::contourArea outputs 0). So for each pixel you should get: [ f1 f2 f3 fN ] [ l1 ] (f=features, l=label) Use this matrix to train an SVM. findContours() to grab the contours of all the blobs then filter using contour area with cv2. fillPoly() to fill in all pixels with white Sep 29, 2017 · I am trying to find/calculate the contour area in the next image: The goal is to delete all the dots you can see in image, so the blobs contoured with an area smaller than a value I give. connectedComponentsWithStats() without a problem. so, you've got a vector< vector<Point> > contours. connectedComponentsWithStats area. Essentially: in the first part you will work on the external contours: you will find the coin and the slice external borders Jan 11, 2018 · MSER Sample in OpenCV 2. See full list on tutorialspoint. Using this feature you can determine orientation of a contour by taking the sign of an area. Why is the contour area being calculated incorrectly, and how may I fix it? The following is the code I'm using to calculate the areas of all contours of the image. A Jun 13, 2018 · For this image, there are three domain colors: (1) the background-yellow (2) the folder-blue (3) the paper-white. The actual goal is then to find a contour that yields said "approximate pixel count area" when put into cv. Finding and drawing contours using OpenCV. But when I find its area, it returns 0. The 2nd image from the left below is the mask. contourArea (or any other polygon area calculaiton formula for what it's worth) – Oct 28, 2019 · It has as many elements as the number of contours. MSER Sample in OpenCV 2. Now that the external contour is filled, we can find the outer contour with cv2. A simple approach would be to close the holes in the foreground to form a single contour with cv2. morphologyEx() and cv2. g. Specifically, we can use cv2. inRange() to return a binary mask showing all the locations of the color/label/value you want and then use cv2. The cv2. findContours() and use cv2. May 4, 2022 · I have an algorithm to count the number of people in video. Here's the result with the w in pixels drawn onto the image. FILLED) sigle_green_line = cv. Extent is the ratio of contour area to bounding rectangle Feb 25, 2016 · Study OpenCV implementation of drawContour function with the FILLED option and access the pixels enclosed by the contour in the same manner. Counting the no. Jan 8, 2013 · contour: input vector of 2D points (contour vertices) oriented: oriented area flag. countNonZero to count how many of them there are. Thank you very much, your help is very appreciated. 2. findCountours() or cv. Jun 13, 2020 · How can i detect black pixels surrounded by closed white pixels? Background outside shapes should not be considered. I have retrieved a contour from an image and want to specifically work on the pixels in the contour. However, since the white regions are highly fragmented with black regions within and ridged around the edges, the number of contours returned by cv2. But now it is not. array) Gray Scale Image Returns: Cordinates : (list) List of cordinates [x, y, w h] ''' # Getting the Thresholds and ret ret,thresh = cv2. 1 Detailed description contourArea gives area different to pixel count. How to extract only top-level contours? MSER Sample in OpenCV 2. Jun 27, 2019 · Use a mask. Mar 2, 2021 · I think the closest what i am looking for is a pixel count e. 001; // Contour approximation accuracy // Calculate convex hull of original points (which points positioned on the boundary) convexHull(Mat(originalPoints),convexHull,false); // Approximating polygonal curve to Mar 29, 2021 · So let’s learn about contours and contour detection, using OpenCV, and see for ourselves how they can be used to build various applications. Feb 27, 2019 · I currently have a source image of: Source image And I have made a bounding rects for each as an ROI: Rects My goal is to find the number of red pixels inside each rect. It check if the green bar also contains a blue color. bitwise_and Dec 20, 2022 · Another, much more complex way, is to interpolate linearly between the pixels of the contour and their neighbors, to get subpixel points. Thus, the returned area and the number of non-zero pixels, if you draw the contour using drawContours or fillPoly , can be different. The circumference of the circle should be around pi2100 = 628,31 and the area should be approximatly pi*100^2=31415. Application of Contours in Computer Vision; What are contours? Steps for finding and drawing contours using OpenCV. Next Tutorial: Contour Properties. threshold(image, 0, 1, 0) # Checking the version of open cv I tried for (version 4) # Getting Mar 10, 2014 · I am looking for the fastest way to iterate through the pixels in a contour. com Apr 18, 2015 · The area is calculated in pixels, so this would give you the number of pixels. Now i want to measure the height of each column for each of the contours, and display the minimum height, maximum height and maybe even the height every n Aug 26, 2022 · You can create a black image of the same size as the original image. countNonZero() to find all white pixels and then calculate the area using your calibrated pixel metric (my area is different since I don't the exact original image) Sep 17, 2021 · I am trying to detect human body mask, but my algorithm sometimes makes mistake like the image below. Each contour is stored as a vector of points. For black images you get the total number of pixels (rows*cols) and then subtract it from the result you get from cv2. h_next() 1) find contour (in this case rectangle, contour that is not rectangle is much harder to make) 2) find coordiantes of contour. 2 on Visual Studio 2012. findContours is Aug 1, 2019 · I have been using OpenCV's findContours() to find areas of contiguous black pixels. Try this and check if it prints 4 cvSeq objects : while contours: print contours contours = contours. findContours on your image, you will have received a structure that lists all of the contours available in your image. Now i want to measure the height of each column for each of the contours, and display the minimum height, maximum height and maybe even the height every n Jun 29, 2012 · Hi, My question seems to be simple. Draw contour with thickness=CV_FILLED in to a new Mat. findContours() which returns among other things, the list of contours (a Pythonic list of arrays representing contours of the picture). If the contour passes some minimum threshold area, then we draw it otherwise we ignore the contour. Aug 23, 2017 · I'm working with a little project with application of OpenCV and I'm stuck with something that I don't know how to implement. for example if I get a contour of 4 x 4 pixel than i want to print not just the contour but all the coordiantes of the pixels it encloses in opencv Sep 29, 2016 · Suppose if we are working on an image, is there any way to access the pixels inside the contour? I have already found the contour using the function findContours() and even found the moments but I Jul 29, 2015 · What I understand is the contourarea and the moment code will give the same result. contourArea() in order to understand the context of the returned value. EDIT. Consider I have a black image with a single white pixel in it. Jan 19, 2015 · Opencv's function cv::findCountours returns a vector with as many elements as there are isolated sets of connected pixels in the image, and this is also known as a 'blob'. How to extract only top-level contours? Apr 10, 2023 · Hello everyone, beginner OpenCV student here: I am trying to overlay 2 images (or binary images) on each other and I need to find the area of the section where both images intersect. of black to white pixels in the 5 days ago · contour: input vector of 2D points (contour vertices) oriented: oriented area flag. 3) arclength is measuring the countour in pixel? Anyone can help? Apr 5, 2016 · After creating the required mask as shown in previous answer or by any other means, you can create a contour around the mask image. How can Jul 3, 2012 · Depending on your workflow or end goal the following may work for you. This repo demostrates how to implement one. In this article, we will learn. Should add color profile embedder in next version. Nov 29, 2016 · Area of a single pixel object in OpenCV. findContours(imgGray, cv2. But you'll have to reconstruct a correct topology. kgfiryzwhnjcijlcfigodnarriplsyzyabifxkcbnkccawxsozajga