MCPcopy Create free account
hub / github.com/SSARCandy/Coherent-Line-Drawing / computeNewVector

Method computeNewVector

src/ETF.cpp:102–122  ·  view source on GitHub ↗

* Paper's Eq(1) */

Source from the content-addressed store, hash-verified

100 * Paper's Eq(1)
101 */
102cv::Vec3f ETF::computeNewVector(const int x, const int y, const int kernel)
103{
104 const cv::Vec3f t_cur_x = flowField.at<cv::Vec3f>(y, x);
105 cv::Vec3f t_new = cv::Vec3f(0, 0, 0);
106
107 for (int r = y - kernel; r <= y + kernel; ++r) {
108 for (int c = x - kernel; c <= x + kernel; ++c) {
109 if (r < 0 || r >= refinedETF.rows || c < 0 || c >= refinedETF.cols) continue;
110
111 const cv::Vec3f t_cur_y = flowField.at<cv::Vec3f>(r, c);
112
113 const float phi = computePhi(t_cur_x, t_cur_y);
114 const float w_s = computeWs(cv::Point2f(x, y), cv::Point2f(c, r), kernel);
115 const float w_m =
116 computeWm(cv::norm(gradientMag.at<cv::Vec3f>(y, x)), cv::norm(gradientMag.at<float>(r, c)));
117 const float w_d = computeWd(t_cur_x, t_cur_y);
118 t_new += phi * t_cur_y * w_s * w_m * w_d;
119 }
120 }
121 return cv::normalize(t_new);
122}
123
124/*
125 * Paper's Eq(5)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected