Skip to content

Commit

Permalink
fix: not to flip input images horizontally when mediapipe outputs images
Browse files Browse the repository at this point in the history
  • Loading branch information
homuler committed Feb 21, 2021
1 parent ee7c909 commit 28e429c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Copied from mediapipe/graphs/instant_motion_tracking/instant_motion_tracking.pbtxt
#
# CHANGES:
# - Remove GIF related inputs
# - Add ImageTransformationCalculator and flips the input
# - Add GlScalerCalculator and flips the output

# MediaPipe graph that performs region tracking and 3d object (AR sticker) rendering.

# Images in/out of graph with sticker data and IMU information from device
Expand All @@ -21,6 +28,7 @@ input_stream: "sticker_proto_string"
input_stream: "imu_rotation_matrix"
output_stream: "output_video"

# Flip vertically because the input image is aligned from bottom-left to top-right.
node: {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:input_video"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Copied from mediapipe/graphs/instant_motion_tracking/instant_motion_tracking.pbtxt
#
# CHANGES:
# - Remove GIF related inputs
# - `input_video` is ImageFrame (ImageFrameToGpuBufferCalculator converts it into GpuBuffer)
# - Add ImageTransformationCalculator and flips the input
# - Add GlScalerCalculator and flips the output
# - `output_video` is ImageFrame

# MediaPipe graph that performs region tracking and 3d object (AR sticker) rendering.

# Images in/out of graph with sticker data and IMU information from device
Expand All @@ -27,6 +36,7 @@ node: {
output_stream: "input_video_gpu"
}

# Flip vertically because the input image is aligned from bottom-left to top-right.
node: {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:input_video_gpu"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# This file is OfficialDemoAndroid's config file (Copied from mediapipe/graphs/hand_tracking/hand_tracking_mobile.pbtxt).
#
# CHANGES:
# - Add ImageTransformationCalculator and rotate the input
# - Add ImageTransformationCalculator and flips the input
# - Add GlScalerCalculator and flips the output

# MediaPipe graph that performs multi-hand tracking with TensorFlow Lite on GPU.
Expand Down Expand Up @@ -55,15 +55,14 @@ node {
output_stream: "throttled_input_video"
}

# Flip vertically because the input image is aligned from bottom-left to top-right,
# and horizontally to use Web Camera.
# Flip vertically because the input image is aligned from bottom-left to top-right.
node: {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:throttled_input_video"
output_stream: "IMAGE_GPU:transformed_input_video"
node_options: {
[type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] {
rotation_mode: 3
flip_vertically: true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# CHANGES:
# - Add FlowLimiterCalculator
# - Add ImageTransformationCalculator and rotate the input
# - Add ImageTransformationCalculator and flips the input
# - Use SidePacket instead of ConstantSidePacketCalculator

# MediaPipe graph that performs hands tracking on desktop with TensorFlow
Expand All @@ -41,15 +41,14 @@ node {
output_stream: "throttled_input_video"
}

# Flip vertically because the input image is aligned from bottom-left to top-right,
# and horizontally to use Web Camera.
# Flip vertically because the input image is aligned from bottom-left to top-right.
node: {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE:throttled_input_video"
output_stream: "IMAGE:transformed_input_video"
node_options: {
[type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] {
rotation_mode: 3
flip_vertically: true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#
# CHANGES:
# - `input_video` is ImageFrame (ImageFrameToGpuBufferCalculator converts it into GpuBuffer)
# - Add ImageTransformationCalculator and rotate the input
# - Add ImageTransformationCalculator and flips the input
# - Add GlScalerCalculator and flips the output
# - `output_video` is ImageFrame

Expand Down Expand Up @@ -63,15 +63,14 @@ node: {
output_stream: "throttled_input_video_gpu"
}

# Flip vertically because the input image is aligned from bottom-left to top-right,
# and horizontally to use Web Camera.
# Flip vertically because the input image is aligned from bottom-left to top-right.
node: {
calculator: "ImageTransformationCalculator"
input_stream: "IMAGE_GPU:throttled_input_video_gpu"
output_stream: "IMAGE_GPU:transformed_input_video"
node_options: {
[type.googleapis.com/mediapipe.ImageTransformationCalculatorOptions] {
rotation_mode: 3
flip_vertically: true
}
}
}
Expand Down

0 comments on commit 28e429c

Please sign in to comment.