Normalize motion sampling with low-pass capture; 285 native and 19 independent checks pass
这个提交包含在:
1 父节点
3b57e36eb1
当前提交
c771a9274a
7 个文件已更改
+275
-4
没有与搜索条件相匹配的文件
@@ -29,6 +29,22 @@ static dy::GrayFrame frame(int w,int h,double tx=0,double ty=0,double angle=0,
|
||||
return f;
|
||||
}
|
||||
|
||||
// Isolate robust fitting and confidence from optical flow: coherent cloth-like
|
||||
// 2.15px residuals plus 10% gross outliers, with a known mean translation.
|
||||
class FitBudgetFlow final : public dy::FlowBackend {
|
||||
public:
|
||||
bool reset(const dy::GrayFrame&)override{return true;}
|
||||
bool advance(const dy::GrayFrame&,const std::vector<dy::FlowPoint>& points,
|
||||
std::vector<dy::FlowMatch>& out)override{
|
||||
for(size_t i=0;i<points.size();i++){
|
||||
float angle=float(i)*2.39996323f;
|
||||
float dx=2.25f+2.15f*cosf(angle),dy=-1.5f+2.15f*sinf(angle);
|
||||
if(i%10==0){dx+=35;dy-=25;}
|
||||
auto p=points[i];out.push_back({p,{p.x+dx,p.y+dy},0});
|
||||
}return true;
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc,const char*argv[]) {@autoreleasepool {
|
||||
NSMutableArray *checks=[NSMutableArray array];bool all=true;
|
||||
auto record=[&](NSString *name,bool pass,NSDictionary *extra=nil) {
|
||||
@@ -36,6 +52,13 @@ int main(int argc,const char*argv[]) {@autoreleasepool {
|
||||
d[@"name"]=name;d[@"pass"]=@(pass);[checks addObject:d];all&=pass;
|
||||
};
|
||||
NSURL *library=argc>1?[NSURL fileURLWithPath:[NSString stringWithUTF8String:argv[1]]]:nil;
|
||||
{
|
||||
dy::Tracker tracker;tracker.setBackend(std::make_shared<FitBudgetFlow>());
|
||||
auto image=frame(640,480);bool started=tracker.reset(image,{.5,.5,.85,.85,0});
|
||||
auto result=tracker.track(image);double ex=fabs(result.cx-(.5+2.25/640))*640,ey=fabs(result.cy-(.5-1.5/480))*480;
|
||||
record(@"coherent-residual-fit-budget-with-ten-percent-outliers",started&&result.valid&&ex<.8&&ey<.8&&fabs(result.scaleX-1)<.02&&fabs(result.scaleY-1)<.02,
|
||||
@{@"scope":@"Controlled correspondence unit test; not an optical-flow image oracle",@"inliers":@(result.inliers),@"matches":@(result.matches),@"confidence":@(result.confidence),@"xErrorPixels":@(ex),@"yErrorPixels":@(ey)});
|
||||
}
|
||||
for(int mode=0;mode<(library?2:1);mode++) {
|
||||
NSString *prefix=mode?@"metal":@"cpu";
|
||||
auto setup=[&](dy::Tracker& tracker) {
|
||||
|
||||
在新工单中引用
屏蔽一个用户