0

I have been working with OpenCv for months and I was wondering if someone can help me with one of the algorithms.

I want to calculate the Feret's diameter (8, 16,32 or 64) with c++ and in OpenCv library, I couldn't find any function.

Can any one suggest any solution or algorithm?

Thanks

Claudio
  • 7,474
  • 3
  • 18
  • 48
M.imaging
  • 21
  • 1

1 Answers1

1

You can use the rotation of the bounding box, but it is the brute force solution. Here is a simpler solution using the convex hull.

I think that this link is a faster algorithm using the Freeman chain code.

FiReTiTi
  • 5,597
  • 12
  • 30
  • 58
  • Im working on the rotating bounding box, it works OK but Im sure its not the easiest solution. – M.imaging Feb 16 '16 at 15:35
  • Thanks for your answer. But they are working in Matlab not c++. In matlab there is a function called imferetdiameter that calculates the Feret's diameter – M.imaging Feb 16 '16 at 15:36
  • These algorithms are given to be much faster, and it would make a big difference considering how slow the rotating bounding box algorithm is. I haven't implemented them. – FiReTiTi Feb 16 '16 at 18:08
  • Here is my C++ implementation of the Feret diameters from the convex hull: https://github.com/DIPlib/diplib/blob/43817114fe1dd0dc11b2f8ab7fe5c154b166542e/src/measurement/measure_polygon.cpp#L115 – Cris Luengo Sep 07 '22 at 00:38