# Revision history [back]

### what is the most effective way to measure middle width of trapezoid? C++

I need to measure the middle width of trapezoid using opencv c++ as below.

C:\fakepath\uoCu0.png

I have an good suggestion from stackoverflow (https://stackoverflow.com/questions/52827604/measure-center-width-of-trapezoid-opencv) but it is only for Python. I've learnt that it is not easy to convert the followings python codes to c++ especially the following bits.

#Calclate the higest and lowest point
top = tuple(cnt[cnt[:, :, 1].argmin()][0])
bottom = tuple(cnt[cnt[:, :, 1].argmax()][0])


Therefore I am looking for another way to measure the width. Is there any good suggestion?

 2 None berak 32993 ●7 ●81 ●312

### what is the most effective way to measure middle width of trapezoid? C++

I need to measure the middle width of trapezoid using opencv c++ as below.

I have an good suggestion from stackoverflow (https://stackoverflow.com/questions/52827604/measure-center-width-of-trapezoid-opencv) but it is only for Python. I've learnt that it is not easy to convert the followings python codes to c++ especially the following bits.

#Calclate the higest and lowest point
top = tuple(cnt[cnt[:, :, 1].argmin()][0])
bottom = tuple(cnt[cnt[:, :, 1].argmax()][0])


Therefore I am looking for another way to measure the width. Is there any good suggestion?