0

I have python script and I try to rewrite it using pythonnet in .net. This But i confuse how to convert this line in python to .net?

contours = sorted(contours, key = cv2.contourArea, reverse = True)[:10]
nawar
  • 63
  • 10

1 Answers1

0

using System.Linq;

var sorted = contours
  .OrderByDescending(c => c.ContourArea)
  .Take(10);
  • thank you it working well. But i want to mention note for the reader searcher of the same problem that i used cv2 so rather than "c => c.ContourArea" I wrote "cv2.contourArea". of course after importing cv2 "dynamic cv2 = Py.Import("cv2");" – nawar Mar 27 '22 at 21:03