# How can i found bottom left contour coordinates with opencv

**URL:** <https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347>\
**Category:** Python\
**Tags:** imgproc\
**Created:** [March 24, 2021, 7:25pm UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347 "2021-03-24T19:25:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustafa\_SENEL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mustafa_senel/32/1530_2.png) [@Mustafa\_SENEL](https://forum.opencv.org/u/Mustafa_SENEL)\
**Post date:** [March 24, 2021, 7:25pm UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/1 "2021-03-24T19:25:28Z")

</div>

![e4](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/8/8c72a6bec216fd441a5008b2d9d0f0ecc0b9e7dc.jpeg)

import cv2  
import numpy as np

img = cv2.imread(‘ex4.jpg’)

gray = cv2.cvtColor(img, cv2.COLOR\_BGR2GRAY)  
kernel\_size = 7  
kernel = np.ones((3,3),np.uint8)  
gray = cv2.dilate(gray, kernel, iterations=4)  
gray = cv2.erode(gray, kernel, iterations=4)

blur = cv2.blur(gray, (5, 5))  
blur\_gray = cv2.GaussianBlur(blur, (kernel\_size, kernel\_size), 1)

edged = cv2.Canny(blur\_gray, 30, 180)

contours, \_ = cv2.findContours(edged, cv2.RETR\_TREE, cv2.CHAIN\_APPROX\_SIMPLE)

cnt = max(contours, key=lambda x: cv2.contourArea(x))

epsilon = 0.0005\*cv2.arcLength(cnt, True)  
approx = cv2.approxPolyDP(cnt, epsilon, True)  
print(contours)

cv2.drawContours(img, contours, -1, (0, 255, 0), 2)

cv2.imshow(‘Contours’, img)  
cv2.waitKey(0)  
cv2.destroyAllWindows()

---

<div class="post-metadata">

**Author:** ![Alejandro\_Silvestri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/alejandro_silvestri/32/357_2.png) [@Alejandro\_Silvestri](https://forum.opencv.org/u/Alejandro_Silvestri)\
**Post date:** [March 25, 2021, 1:35am UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/2 "2021-03-25T01:35:18Z")

</div>

You can compute distances from the image lower left vertex to each point in the contour, and get that with the closest, the one with the shortest distance.

---

<div class="post-metadata">

**Author:** ![Mustafa\_SENEL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mustafa_senel/32/1530_2.png) [@Mustafa\_SENEL](https://forum.opencv.org/u/Mustafa_SENEL)\
**Post date:** [March 25, 2021, 7:50am UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/3 "2021-03-25T07:50:50Z")

</div>

Actually I need to find the smallest value in the contour array for x axis

---

<div class="post-metadata">

**Author:** ![kubilaye](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/kubilaye/32/1540_2.png) [@kubilaye](https://forum.opencv.org/u/kubilaye)\
**Post date:** [March 25, 2021, 9:58am UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/4 "2021-03-25T09:58:06Z")

</div>

You need brain bro. just think a little

---

<div class="post-metadata">

**Author:** ![Mustafa\_SENEL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mustafa_senel/32/1530_2.png) [@Mustafa\_SENEL](https://forum.opencv.org/u/Mustafa_SENEL)\
**Post date:** [March 25, 2021, 10:01am UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/5 "2021-03-25T10:01:09Z")

</div>

Kubilaye, i need some help. Dont trolling bro

---

<div class="post-metadata">

**Author:** ![Alejandro\_Silvestri](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/alejandro_silvestri/32/357_2.png) [@Alejandro\_Silvestri](https://forum.opencv.org/u/Alejandro_Silvestri)\
**Post date:** [March 25, 2021, 11:44am UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/6 "2021-03-25T11:44:48Z")

</div>

This PyImageSearch article shows how to get extreme points.

> **[Finding extreme points in contours with OpenCV - PyImageSearch](https://www.pyimagesearch.com/2016/04/11/finding-extreme-points-in-contours-with-opencv/)**
>
> Learn how to extract the top-most (north), bottom-most (south), right-most (east), and left-most (west) extreme points from a contour using OpenCV & Python.

Look for extLeft in line 24. I believe you don’t need to compute convexHull, you can apply that line to you contour:

```
extLeft = tuple(c[c[:, :, 0].argmin()][0])
```

---

<div class="post-metadata">

**Author:** ![Mustafa\_SENEL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/mustafa_senel/32/1530_2.png) [@Mustafa\_SENEL](https://forum.opencv.org/u/Mustafa_SENEL)\
**Post date:** [March 25, 2021, 3:50pm UTC](https://forum.opencv.org/t/how-can-i-found-bottom-left-contour-coordinates-with-opencv/2347/7 "2021-03-25T15:50:31Z")

</div>

I solved it this way. Thanks for your time

> cnt = contours[0]  
> extLeft = tuple(cnt[cnt[:, :, 0].argmin()][0])
