Ask Your Question

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

asked 2018-10-24 21:26:00 -0600

yan03 gravatar image

updated 2018-10-25 01:30:02 -0600

berak gravatar image

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


I have an good suggestion from stackoverflow ( 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?

edit retag flag offensive close merge delete


could you give more c++ code?

jsxyhelu gravatar imagejsxyhelu ( 2018-10-27 21:14:26 -0600 )edit

@jsxyhelu, thanks for your reply. the code is in the following link:

yan03 gravatar imageyan03 ( 2018-10-30 17:20:08 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-10-26 05:30:58 -0600

The thing is I DO understand the math. But I have no idea how to convert any of it to programming.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-10-24 21:26:00 -0600

Seen: 238 times

Last updated: Oct 25 '18