[JAVA] Extreme points in contours

asked 2019-02-11 05:20:13 -0500

updated 2019-02-11 05:48:02 -0500

Hi everyone!

I need to find the coordinate of the top point of the largest contour in the scene. I can find the largest contour but I can't find info about extreme points in java. This is what I found in Python:

extTop = tuple(c[c[:, :, 1].argmin()][0])
extBot = tuple(c[c[:, :, 1].argmax()][0])

Can someone help me to understand how to do that in Java?

Thank you!

edit retag flag offensive close merge delete

Comments

sorry, but the code you show is numpy not from opencv or even c++

berak gravatar imageberak ( 2019-02-11 05:31:13 -0500 )edit

Yes sorry, it was Python, I got confused...Do you know how to find the extreme points of a contours?

GuybrushThreepwood gravatar imageGuybrushThreepwood ( 2019-02-11 05:49:02 -0500 )edit

You can find all extreme points and then compare them with each other.

Here is solution of finding all extreme points for c++ and here is solution for Javascript. Look at them and try to convert to Java.

Lucy8 gravatar imageLucy8 ( 2019-02-13 00:54:27 -0500 )edit