Skip to content

runs canny edge detection to gather heuristics for car geometry

Notifications You must be signed in to change notification settings

dotkalm/BootedWebAppFrontend

Repository files navigation

BOOTED v1

booted demo

At a glance

Front end web app that communicates with an image recognition api to overlay an object onto a photo from device’s camera using threeJS.

Overview

Background

I was living in Santa Monica, CA, and often saw very expensive cars parked on the street, naturally I wanted to boot them.

Concept

Place a `parking enforcement boot` on photos of cars.

Why?

Pranking people

Technical Goal

Overlay 3d asset on 2-d image, scale correctly, rotate correctly, place on correct spot with correct lighting.

Front end requirements

  1. Send image to server
  2. Receive coordinates of car tire bounding box and basic geometric heuristics from backend.
  3. Correctly orient 3d asset, scale, and place accordingly

Known imitations of v1

  1. Always chooses tire on the right of the image
  2. Only basic perspective is created using 1 axis determined by the car's wheels
  3. Lighting is not matched

How I made v1

Storybook screenshot

Developed With Fixtures using Storybook

Created fixtures to mock api response and used storybook to help establish the baseline orientation of the 3d asset
zAxis

Establishing Z-Axis

I realized that I could approximate the z-axis of the object by drawing a line from the center of each tire and calculating the angle of that line.
zAxis

Scaling object and placing on target

  1. After orienting the asset on the correct z-axis I then create a 2d image from the 3d context.

  2. Once the asset is 2d I scale the circular clamp of the boot according to the size of the tire's ellipse.

  3. I then calculate the distance of the car tire from the center of the image and use those coordinates to shift the 2d parking boot onto the target.

What to expect from v2

Leverage homography

  1. Correctly determine the camera's perspective in the original photo
  2. Apply the perspective from the original world-view to the camera perspective in threeJs homography

Apply lighting

  1. Collect lighting heuristics from API
  2. Use lighting sources in threeJs to match asset to scene

About

runs canny edge detection to gather heuristics for car geometry

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published