pthuoshan 发表于 2024-1-21 18:17:25

请问在火山中如何实现python中的sorted()功能

sorted(iterable, cmp=None, key=None, reverse=False)

呵呵仙8 发表于 2024-1-21 18:25:40

c++有的排序,你照写就是!

pthuoshan 发表于 2024-1-24 17:20:38

本帖最后由 pthuoshan 于 2024-1-24 17:24 编辑

呵呵仙8 发表于 2024-1-21 18:25
c++有的排序,你照写就是!
bool sortByArea(const vector<Point>& contour1, const vector<Point>& contour2)
{
double area1 = contourArea(contour1);
double area2 = contourArea(contour2);
return area1 > area2;
}
sort(contours.begin(), contours.end(), sortByArea);

自定义函数,这个sort()排序在火山里面要怎么弄?大佬给个思路。CV坐标容器数组 要排序,转火山这个sort()不知道咋办?

呵呵仙8 发表于 2024-1-24 17:52:36

如果不会c++,就火山表格代码写排序呗!参考
https://bbs.voldp.com/thread-17492-1-1.html

pthuoshan 发表于 2024-1-24 22:58:10

本帖最后由 pthuoshan 于 2024-1-25 20:06 编辑

呵呵仙8 发表于 2024-1-24 17:52
如果不会c++,就火山表格代码写排序呗!参考
https://bbs.voldp.com/thread-17492-1-1.html ...
1、CV坐标容器数组没办法交换成员,不知道怎么弄,麻烦写一下。2、这个sort()排序的功能在火山里面要怎么弄。



页: [1]
查看完整版本: 请问在火山中如何实现python中的sorted()功能