package project import ( "html/template" ) var Template *template.Template func init() { Template = template.Must(template.New("webpage").Funcs(template.FuncMap{ "DataURI": dataImg, }).Parse(tpl)) } const tpl = `

Open Speed Data Analysis

save exit

{{ if .Err }} {{ end }}

Video File

{{.Filename}} Frames: {{.Frames}} Duration: {{.Duration}} Resolution: {{.VideoResolution}}

{{ if eq .Step 1}}

Step 1: Crop

Instructions: Click on the image below to select the upper left and lower right corner of the frame to perform speed analysis on. After selecting "point1" and "point2" select the "Continue" button.

{{ else if gt .Step 1 }}

Step 1: Crop

Selected Range {{.PreCrop}} Cropped Resolution: {{.Response.PreCroppedResolution}}

{{ else }} {{ end}} {{ if eq .Step 2 }}

Step 2: Rotation Detection

Automatic rotation detection works by picking two points that align with the asis of vehicle movement

Instructions: Click on the image below to select two points on the axis of movement. Typically this will be a lane marking in the middle of the street at either end of the visible range. After selecting "point1" and "point2" select the "Continue" button.

To skip rotation enter 0x0 as both points.

{{ else if gt .Step 2 }}

Step 2: Rotation

Rotation Angle {{.Rotate}} radians

{{ else }} {{ end }} {{ if eq .Step 3 }}

Step 3: Crop

Instructions: Click on the image below to select the upper left and lower right corner of the frame to perform speed analysis on. After selecting "point1" and "point2" select the "Continue" button.

{{ else if gt .Step 3 }}

Step 3: Crop

Selected Range {{.PostCrop}} Cropped Resolution: {{.Response.CroppedResolution}}

{{ else }} {{ end }} {{ if eq .Step 4 }}

Step 4: Mask Regions

Masking allows the detection of vehicles in different lanes to avoid bleeding into each other, and eliminates irrelevant parts of the image (like sidewalks or parked cars). Depending on the visual perspective the masked rows should be closer to wheel position to account for tall vehicles in the lane.

Instructions: Note the X and Y from the image, and enter masks as a row range row:row or a bounding box pair of coordinates 10x20 20x30. To continue without masks enter a mask of -.

Mouse Position:

{{ else if gt .Step 4 }} {{ if .Masks }}

Step 4: Mask Regions

Masked regions: {{range .Masks }}{{.}} {{end}}

{{ range .Masks }} {{ end }} {{ end }} {{ else }} {{ range .Masks }} {{ end }} {{ end }} {{ if eq .Step 5 }}

Step 5: Object Detection

The tunables below adjust what is detected as "active" in an image, and what is treated as a vehicle.

The required difference from the background. Valid range: 0 to 255.
Bluring helps define features better and make a single blob for better detection.
The number of agacent pixels that are checked when detecting contiguous areas. Must be >= 1
Filters out small areas that are detected in the image (such as pedestrians).

Background Image:

{{ range .Response.FrameAnalysis }}

Time index {{.Timestamp}} seconds

Frame: (before masking)

base-gif

Active Image:

highlight-gif

Detected Areas: (after masking)

colored-gif

Time index {{.Timestamp}} seconds

Frame: (before masking)

base

Active Image:

highlight

Detected Areas: (after masking)

colored {{ if .Positions }} {{ range $i, $p := .Positions }} {{ end }}
MassPositionSize
{{$i}} {{$p.Pixels }} pixels {{$p.Center.X}}x{{$p.Center.Y}} {{$p.Bounds.Dx}}x{{$p.Bounds.Dy}}
{{ end }}
{{ end }}
{{ else if gt .Step 5 }}

Step 5: Object Detection

Tolerance: {{.Tolerance}}

Blur: {{.Blur}}

Contiguous Pixels: {{.ContiguousPixels}}

Min Mass: {{.MinMass}}

Background Image:

{{ else }} {{ end }} {{ if eq .Step 6 }}

Step 6: Position Detection

{{ if .Response.VehiclePositions }} {{ range .Response.VehiclePositions }} {{ end }}
FrameTimeVehiclePositionMassSize
{{.Frame}} {{.Time}} {{.VehicleID}} {{.Position.Center.X}}x{{.Position.Center.Y}} {{.Position.Pixels }} pixels {{.Position.Bounds.Dx}}x{{.Position.Bounds.Dy}}
{{ end }} {{ end }} {{ if eq .Step 7 }}

Step 7: Speed Calibration

Calibrations: {{range .Calibrations }}{{.Pretty}}
{{end}}

{{ range .Calibrations }} {{ end }}
{{ if .Seek }}
NV200 wheelbase is 115.2"
{{ end }} {{ else if gt .Step 7 }} {{ range .Calibrations }} {{ end }} {{ end }} {{ range .Response.DebugImages }} {{ end }}
 
`