class GenerateVideoAnnotationPatch extends GenerateAnnotationPatch

Traits

SerializesModels
InteractsWithQueue
Queueable
Dispatchable

Properties

protected Annotation $annotation

The the annotation to generate a patch for.

from  GenerateAnnotationPatch
protected string $targetDisk

The storage disk to store the annotation patches to.

from  GenerateAnnotationPatch
protected bool $deleteWhenMissingModels

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

from  GenerateAnnotationPatch

Methods

void
__construct(Annotation $annotation, string|null $targetDisk = null)

Create a new job instance.

void
handle()

Execute the job.

handleFile(VolumeFile $file, string $path)

Handle a single image.

string
getTargetPath(Annotation $annotation)

Assemble the target path for an annotation patch.

bool
shouldRetryAfterException(Exception $e)

Determine if this job should retry instead of fail after an exception

array
getPatchRect(array $points, Shape $shape, int $thumbWidth, int $thumbHeight)

Calculate the bounding rectangle of the patch to extract.

array
makeRectContained(array $rect, Image $image)

Adjust the position and size of the patch rectangle so it is contained in the image.

string
getAnnotationPatch(Image $image, array $points, Shape $shape)

Get the annotation patch as buffer.

Video
getVideo(string $path)

Get the FFMpeg video instance.

Image
getVideoFrame(Video $video, float $time)

Get a video frame from a specific time as VipsImage object.

Details

void __construct(Annotation $annotation, string|null $targetDisk = null)

Create a new job instance.

Parameters

Annotation $annotation

The the annotation to generate a patch for.

string|null $targetDisk

The storage disk to store the annotation patches to.

Return Value

void

void handle()

Execute the job.

Return Value

void

at line 20
handleFile(VolumeFile $file, string $path)

Handle a single image.

Parameters

VolumeFile $file
string $path

Path to the cached file.

protected string getTargetPath(Annotation $annotation)

Assemble the target path for an annotation patch.

Parameters

Annotation $annotation

Return Value

string

protected bool shouldRetryAfterException(Exception $e)

Determine if this job should retry instead of fail after an exception

Parameters

Exception $e

Return Value

bool

protected array getPatchRect(array $points, Shape $shape, int $thumbWidth, int $thumbHeight)

Calculate the bounding rectangle of the patch to extract.

Parameters

array $points
Shape $shape
int $thumbWidth
int $thumbHeight

Return Value

array

Containing width, height, top and left

protected array makeRectContained(array $rect, Image $image)

Adjust the position and size of the patch rectangle so it is contained in the image.

Parameters

array $rect
Image $image

Return Value

array

protected string getAnnotationPatch(Image $image, array $points, Shape $shape)

Get the annotation patch as buffer.

Parameters

Image $image
array $points
Shape $shape

Return Value

string

at line 43
protected Video getVideo(string $path)

Get the FFMpeg video instance.

Parameters

string $path

Return Value

Video

at line 56
protected Image getVideoFrame(Video $video, float $time)

Get a video frame from a specific time as VipsImage object.

Parameters

Video $video
float $time

Return Value

Image