class TrackObject extends Job implements ShouldQueue

Attempts to track an obect in a video. The object is initially defined by a video annotation. The annotation will be updated with the positions determined with the object tracking method.

Traits

SerializesModels
Queueable
Dispatchable

Properties

int $tries

The number of times the job may be attempted.

protected VideoAnnotation $annotation

The annotation that defines the initial object to track.

protected User $user

The user who initialized the tracking request.

protected bool $deleteWhenMissingModels

Ignore this job if the annotation does not exist any more.

Methods

static string
getRateLimitCacheKey(User $user)

Return the cache key to store the number of concurrent jobs for each user.

__construct(VideoAnnotation $annotation, User $user)

Create a new instance.

void
handle()

Execute the job.

array
getTrackingKeyframes(VideoAnnotation $annotation)

Execute the object tracking method and get the resulting annotation key frames.

string
getInputJsonPath(VideoAnnotation $annotation)

Get the path to to input file for the object tracking script.

string
createInputJson(VideoAnnotation $annotation, string $videoPath)

Create the JSON file that is the input for the object tracking script.

maybeDeleteFile(string $path)

Delete a file if it exists.

string
getOutputJsonPath(VideoAnnotation $annotation)

Get the path to to output file for the object tracking script.

string
python(string $command)

Execute a Python script.

array
getStartWindow(VideoAnnotation $annotation)

Get the coordinates and dimensions of the start window for the object tracking script.

array
getPointsFromKeyframe(VideoAnnotation $annotation, array $keyframe)

Get the points of a keyframe depending on the annotation shape.

Details

at line 62
static string getRateLimitCacheKey(User $user)

Return the cache key to store the number of concurrent jobs for each user.

Parameters

User $user

Return Value

string

at line 73
__construct(VideoAnnotation $annotation, User $user)

Create a new instance.

Parameters

VideoAnnotation $annotation

The annotation that defines the initial object to track.

User $user

The user who initialized the tracking request.

at line 84
void handle()

Execute the job.

Return Value

void

at line 125
protected array getTrackingKeyframes(VideoAnnotation $annotation)

Execute the object tracking method and get the resulting annotation key frames.

Parameters

VideoAnnotation $annotation

Return Value

array

Each element is an array containing the key frame time as first element and the points as the remaining elements.

at line 159
protected string getInputJsonPath(VideoAnnotation $annotation)

Get the path to to input file for the object tracking script.

Parameters

VideoAnnotation $annotation

Return Value

string

at line 172
protected string createInputJson(VideoAnnotation $annotation, string $videoPath)

Create the JSON file that is the input for the object tracking script.

Parameters

VideoAnnotation $annotation
string $videoPath

Path to the video file.

Return Value

string

Path to the JSON file.

at line 192
protected maybeDeleteFile(string $path)

Delete a file if it exists.

Parameters

string $path

at line 206
protected string getOutputJsonPath(VideoAnnotation $annotation)

Get the path to to output file for the object tracking script.

Parameters

VideoAnnotation $annotation

Return Value

string

at line 218
protected string python(string $command)

Execute a Python script.

Parameters

string $command

Command to execute.

Return Value

string

The last line of the stout output.

at line 241
protected array getStartWindow(VideoAnnotation $annotation)

Get the coordinates and dimensions of the start window for the object tracking script.

Parameters

VideoAnnotation $annotation

Return Value

array

at line 284
protected array getPointsFromKeyframe(VideoAnnotation $annotation, array $keyframe)

Get the points of a keyframe depending on the annotation shape.

Parameters

VideoAnnotation $annotation
array $keyframe

Return Value

array