Home > OS >  convert stored()[:10] function in python to .net syntax (pythonnet)
convert stored()[:10] function in python to .net syntax (pythonnet)

Time:03-28

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]

CodePudding user response:

using System.Linq;

var sorted = contours
  .OrderByDescending(c => c.ContourArea)
  .Take(10);
  • Related