bool Bezier::update() { //if (!ImageNode::update()) return false; if (!Node::update()) return false; cv::Mat out = cv::Mat(cv::Size(Config::inst()->im_width, Config::inst()->im_height), MAT_FORMAT_C3); out = cv::Scalar(0,0,0); std::vector<cv::Point2f> control_points; control_points.push_back( cv::Point2f( getSignal("x0"), getSignal("y0") )); control_points.push_back( cv::Point2f( getSignal("x1"), getSignal("y1") )); control_points.push_back( cv::Point2f( getSignal("x2"), getSignal("y2") )); control_points.push_back( cv::Point2f( getSignal("x3"), getSignal("y3") )); int num = getSignal("num"); if (num < 2) { num = 2; setSignal("num", num); } std::vector<cv::Point2f> bezier_points; getBezier(control_points, bezier_points, num); for (int i = 1; i < bezier_points.size(); i++) { cv::line(out, bezier_points[i-1], bezier_points[i], cv::Scalar(255, 255, 255), 2, CV_AA ); } setImage("out", out); return true; }
// Research purpose (to be removed ?) void JacobianBasis::interpolate(const fullVector<double> &jacobian, const fullMatrix<double> &uvw, fullMatrix<double> &result, bool areBezier) const { fullMatrix<double> bezM(jacobian.size(), 1); fullVector<double> bez; bez.setAsProxy(bezM, 0); if (areBezier) bez.setAll(jacobian); else lag2Bez(jacobian, bez); getBezier()->interpolate(bezM, uvw, result); }
template<typename T> T ofxAlgebraic_<T>::getSignal() { return getBezier(); }
template<typename T> T ofxAlgebraic_<T>::getSignal(T _value) { return getWithAmplitude(_value) + getBezier(); }