Project import generated by Copybara.
GitOrigin-RevId: 43cd697ec87dcc5cab5051f27960bb77a057399d
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
tricorder: {
|
||||
options: {
|
||||
builder: {
|
||||
config: "android_arm64"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ void PolynomialRegressionPathSolver::AddCostFunctionToProblem(
|
||||
const std::vector<FocusPointFrame>& focus_point_frames,
|
||||
const std::vector<FocusPointFrame>& prior_focus_point_frames,
|
||||
const int original_width, const int original_height, const int output_width,
|
||||
const int output_height, std::vector<cv::Mat>* all_xforms) {
|
||||
const int output_height, std::vector<cv::Mat>* all_transforms) {
|
||||
RET_CHECK_GE(original_width, output_width);
|
||||
RET_CHECK_GE(original_height, output_height);
|
||||
const bool should_solve_x_problem = original_width != output_width;
|
||||
@@ -138,9 +138,10 @@ void PolynomialRegressionPathSolver::AddCostFunctionToProblem(
|
||||
Solver::Options options;
|
||||
options.linear_solver_type = ceres::DENSE_QR;
|
||||
|
||||
Solver::Summary summary;
|
||||
Solve(options, &problem_x, &summary);
|
||||
all_xforms->clear();
|
||||
Solver::Summary summary_x, summary_y;
|
||||
Solve(options, &problem_x, &summary_x);
|
||||
Solve(options, &problem_y, &summary_y);
|
||||
all_transforms->clear();
|
||||
for (int i = 0;
|
||||
i < focus_point_frames.size() + prior_focus_point_frames.size(); i++) {
|
||||
// Code below assigns values into an affine model, defined as:
|
||||
@@ -160,7 +161,7 @@ void PolynomialRegressionPathSolver::AddCostFunctionToProblem(
|
||||
yb_, yc_, yd_, yk_);
|
||||
transform.at<float>(1, 2) = delta;
|
||||
}
|
||||
all_xforms->push_back(transform);
|
||||
all_transforms->push_back(transform);
|
||||
}
|
||||
return mediapipe::OkStatus();
|
||||
}
|
||||
|
||||
@@ -40,14 +40,14 @@ class PolynomialRegressionPathSolver {
|
||||
// Given a series of focus points on frames, uses polynomial regression to
|
||||
// compute a best guess of a 1D camera movement trajectory along x-axis and
|
||||
// y-axis, such that focus points can be preserved as much as possible. The
|
||||
// returned |all_xforms| hold the camera location at each timestamp
|
||||
// returned |all_transforms| hold the camera location at each timestamp
|
||||
// corresponding to each input frame.
|
||||
::mediapipe::Status ComputeCameraPath(
|
||||
const std::vector<FocusPointFrame>& focus_point_frames,
|
||||
const std::vector<FocusPointFrame>& prior_focus_point_frames,
|
||||
const int original_width, const int original_height,
|
||||
const int output_width, const int output_height,
|
||||
std::vector<cv::Mat>* all_xforms);
|
||||
std::vector<cv::Mat>* all_transforms);
|
||||
|
||||
private:
|
||||
// Adds a new cost function, constructed using |in| and |out|, into |problem|.
|
||||
|
||||
@@ -24,3 +24,17 @@ cc_binary(
|
||||
"//mediapipe/graphs/hair_segmentation:mobile_calculators",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "hair_segmentation_cpu",
|
||||
deps = [
|
||||
"//mediapipe/examples/desktop:demo_run_graph_main",
|
||||
] + select({
|
||||
"//mediapipe/gpu:disable_gpu": [
|
||||
"//mediapipe/graphs/hair_segmentation:desktop_calculators",
|
||||
],
|
||||
"//conditions:default": [
|
||||
"//mediapipe/graphs/hair_segmentation:mobile_calculators",
|
||||
],
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user