GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Ankit-ku-panda/3D-Motion-Camera: Experimental Android app that creates glasses-free simulated depth effects using offline AI. Includes live camera preview, photo/video import, tilt-controlled perspective, photo capture, and silent MP4 recording.

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
app
app
 
 
docs
docs
 
 
gradle/wrapper
gradle/wrapper
 
 
scripts
scripts
 
 
.gitignore
.gitignore
 
 
BUILD-APK.bat
BUILD-APK.bat
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SOURCE-SHA256.txt
SOURCE-SHA256.txt
 
 
THIRD_PARTY.md
THIRD_PARTY.md
 
 
VALIDATION.md
VALIDATION.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
requirements-build.txt
requirements-build.txt
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

DepthMotion — Android depth-effect camera

An experimental Android APK for live camera, imported photos and imported videos. It uses an offline AI depth model and OpenGL to animate a small change in viewpoint, or follow phone tilt. Save a PNG of the current view or record the animation as a silent H.264 MP4.

Animated demos

Panda — landscape depth-effect demo

Animated panda depth-effect demo in landscape

Neon city — depth-effect demo

Animated neon city depth-effect demo

Looping GIFs from the supplied recordings, slightly zoomed for a closer view. The panda is rotated upright into landscape; the city preview has its black bars cropped out. These demos illustrate sample output, not performance across all devices.

What this can and cannot do

This is a motion-parallax depth illusion on an ordinary display. Both eyes still receive the same image. It is not true binocular/stereoscopic 3D and not a glasses-free theatre viewer.

Pointing a phone at a polarized or shutter-based cinema projection does not separate its two eye views. This app cannot decode that projection, remove its ghosting, or replace cinema 3D glasses. It also does not reverse red/cyan filtering to reconstruct missing colors. Its useful input is ordinary 2D scenes, photos and videos.

Live camera frames remain live while an AI worker periodically updates a low-resolution depth map. AI inference is not guaranteed to run at camera frame rate. Fast objects can move ahead of the cached depth, producing warping. This is a prototype requiring physical-device testing, not a production release or a promise of real-time movie conversion.

Install the supplied APK

  • Android 10 or newer, ARM64 OS, OpenGL ES 2.0 and H.264 encoder required.
  • Copy DepthMotion-0.1.0-arm64.apk to your phone and open it.
  • If Android asks, allow installation from the specific file manager/browser you used. The APK is signed with a development key, not published through Google Play.
  • The offline model is bundled. First launch copies it into internal storage and loads it; this can take time. Allow several hundred MB of storage/RAM headroom.
  • Camera permission is requested only when you tap Camera. No internet, microphone or broad gallery-reading permission is requested.

This is an ARM64 build. An Android 10 phone running a 32-bit OS cannot install it even if its processor supports 64 bits. This build has not been run on your actual phone. Build and model checks are documented in VALIDATION.md.

Use

  1. Start with Demo; wait until the status shows AI depth: … ms.
  2. Choose Camera, Photo or Video. A system file picker opens for imported media.
  3. Mode: sway animates a small sideways viewpoint shift. Tap it for Mode: tilt; hold the phone at a comfortable angle when switching, then tilt gently. Tilt requires a gravity sensor; use sway if your device lacks it.
  4. Adjust Depth strength. Subtle settings reduce distortion. Effect on/off compares with the flat input.
  5. Tap the image to hide/show controls for a larger view. The app stays in portrait orientation; landscape media is letterboxed without stretching.
  6. Save photo saves a static PNG of the current rendered view, including any letterboxing, to Pictures/DepthMotion. A single PNG does not preserve an animated/interactive depth effect.
  7. Record saves the rendered animation, not raw camera video. Tap Stop after at least a few seconds. Output: 720×1280 H.264 MP4 in Movies/DepthMotion.
  8. Share last opens Android's share sheet for your last saved item.

Recordings are silent, including recordings of imported videos. Imported videos play with their normal sound in the app, but the exported effect recording does not copy the source audio. Recording runs while the app is visible; backgrounding stops it. The app does not perform a background full-video export. Source switching is disabled during recording.

Only the rear camera is supported in this prototype. Video inputs must be supported by Android's MediaPlayer; DRM streams and online movie services are not supported. Video looping is enabled. Camera/photo input uses the same neural model; there is no synthetic-depth fallback falsely labelled as AI.

Technical design

  • Native Java Android Activity, no web server or account.
  • Legacy Android Camera preview → SurfaceTexture → OpenGL external texture. The deprecated API keeps this prototype dependency-light; it should be migrated to Camera2/CameraX for a production release.
  • Imported videos: MediaPlayer → same renderer. Photos: ImageDecoder → bounded-size texture.
  • Every available interval, render the unmodified input into a 252×252 offscreen texture, read RGB pixels and normalize using ImageNet mean/std.
  • ONNX Runtime 1.22.0 runs Depth Anything V2 Small, exported to fixed-shape ONNX opset 17 with dynamic per-channel signed-8-bit MatMul weight quantization to reduce APK size. It runs on two CPU threads; no GPU/NPU delegation is claimed.
  • Percentile-normalized relative inverse depth drives an inverse texture warp. The result sways automatically or follows the gravity sensor.
  • One inference at a time; stale results are discarded after an input-source change. A photo gets one depth map. Video/camera depth is refreshed as computation allows, at most approximately 1.25 requests/second.
  • MediaRecorder surface + EGL render the same effect into H.264. MediaStore publishes photos/videos only after a successful save.

The 252×252 input is a performance-oriented adaptation of the original higher-resolution preprocessing and distorts input aspect ratio for inference. It may reduce depth accuracy. There is no optical-flow alignment, temporal depth model, generative hole filling or hidden-scene reconstruction. Texture warping can stretch edges; strong settings are not recommended.

Build from GitHub source

All source and small build files in this archive can be committed to Git. Large model weights and generated APKs are excluded from Git by .gitignore. The build downloads the official model and generates ONNX locally. Users downloading your source ZIP must run the build; users downloading your APK release do not need Python, Android Studio or model downloads.

Requirements:

  • Python 3.11 recommended for model export.
  • JDK 17.
  • Android Studio / Android SDK Platform 35 and Build Tools 35.0.0.
  • Internet for the first dependency/model downloads.
  • Enough disk space for Python/PyTorch, the SDK and Gradle caches.

Open this project in Android Studio so it creates local.properties with your SDK path, or set ANDROID_HOME to your SDK folder. Install SDK Platform 35 if prompted. Then on Windows:

BUILD-APK.bat

That creates an isolated Python environment, exports the model if missing and calls the Gradle wrapper. The APK appears at app/build/outputs/apk/debug/app-debug.apk.

On Linux/macOS:

python3.11 -m venv .tools/python
.tools/python/bin/pip install -r requirements-build.txt
.tools/python/bin/python scripts/export_model.py
chmod +x gradlew
./gradlew assembleDebug

Model export is a separate explicit step. If building directly in Android Studio, run scripts/export_model.py first. The Gradle build checks for the required model and fails clearly when it is absent.

The GitHub Actions workflow also exports the model and builds the APK. Upload this source directory to an empty GitHub repository; find the downloadable APK artifact under Actions → Build APK after a successful workflow run. Remote CI has not been executed as part of this delivery. Publish tested APKs through GitHub Releases, rather than adding generated APKs to the source history.

Debug builds use development signing keys. The supplied APK and a future locally built APK may use different keys; Android then requires uninstalling the older app before installing the new one. For a public release, create and retain your own release-signing key securely.

Troubleshooting

  • AI unavailable: ensure the model was exported and packaged; on a source build, rerun export before assembling. Low memory may also cause inference failure.
  • Slow depth: use short tests and modest strength. Raw camera playback and depth inference have different update rates.
  • Camera denied/unavailable: grant Camera permission in Android settings; close other camera apps. Imported photos/videos work without camera permission.
  • Unsupported video: use a normal SDR H.264 MP4 that Android can play. HDR is not color-managed here.
  • No movement: wait for the first depth result, raise the strength slightly, choose sway mode, and ensure Effect is enabled.
  • Save failed: check storage space. Clips stopped too quickly may be discarded because the encoder has not generated enough data.
  • Heat/battery use: live decoding, OpenGL and neural inference run together. Pause use if the phone becomes uncomfortable to hold; performance can drop with thermal throttling.

Privacy

All inference and processing are local. No network permission, telemetry, cloud upload, account or API key. Camera is released when leaving the app. Imported items are accessed through the system picker. Saved items are visible to gallery apps. Sharing happens only when you choose a destination in the Android share sheet.

Licenses

Application code is MIT (LICENSE). Depth Anything V2 Small is Apache-2.0; its weights are redistributed in the supplied APK in converted ONNX form. The full Apache license, model attribution and modification notice are included in app assets. ONNX Runtime is MIT; its license and third-party notices are included. Gradle wrapper is Apache-2.0. See THIRD_PARTY.md.

Direct SDK build alternative

If you already have JDK 17 and the SDK but cannot download Gradle:

python scripts/build_sdk.py --sdk /path/to/Android/Sdk

Run the model export first. This script downloads and checksum-verifies the Android ONNX Runtime AAR, compiles Java, runs D8/aapt2, adds ARM64 native libraries, aligns and development-signs the APK. This was the build route used for the supplied APK. It writes its temporary key under ignored build/manual/; retain your own signing key for long-term releases. Do not commit that key to Git.

About

Experimental Android app that creates glasses-free simulated depth effects using offline AI. Includes live camera preview, photo/video import, tilt-controlled perspective, photo capture, and silent MP4 recording.

Topics

3d-motion3d-motion-design3d-motion-generation3d-motion-graphics3d-motion-perception3d-motion-trackingandroidandroid-appandroid-applicationandroid-developmentandroid-libraryandroid-studioandroidstudio

Resources

Readme
MIT license
Activity

Stars

12 stars

Watchers

9 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.