CloudAction CloudMask::apply(const CloudAction & cloud) const{ VideoList newVideos; newVideos.reserve(cloud._landmarks.size()); for (const Video & v: cloud._landmarks){ Video newVideo; newVideo.reserve(v.size()); for (auto && cloud: v){ PointCloud<66> newCloud{}; for (auto v: _toKeep){ newCloud[v] = cloud[v]; } newVideo.push_back(newCloud); } newVideos.push_back(newVideo); } return CloudAction(std::move(newVideos), cloud._actionUnits); }
Video randomGaussJittered(const Video & set, double meanx, double stdx, double meany, double stdy){ std::random_device rd; std::mt19937 gen(rd()); std::normal_distribution<> dx(meanx,stdx); std::normal_distribution<> dy(meany,stdy); Video res; res.reserve(set.size()); for(auto && cloud: set){ PointCloud<66> newCloud(cloud); PointArray<66> & points = newCloud.points(); for (cv::Point2f & p: points){ p.x += dx(gen); p.y += dy(gen); } res.emplace_back(std::move(newCloud)); } return res; }