Sequence Module and Workflow

The Sequence class is used for editing sequences of images. It’s primary functions are to smoothly adjust settings between images in the sequence such as exposure, color temperature, and saturation, and to stabilize shaky sequences.

Note

In order to avoid exploding memory requirements, image data typically isn’t kept so a lot of time can be saved or waisted by running processes in particular orders with particular settings. As a result, in order to make things simpler for the user, a number of helper functions have been made to simplify this. Unless there’s a specific reason no to, and the consequences are well understood, using correct helper function is cleaner and sometimes faster than chaining helper functions together.

Usage

In the below examples it’s assumed that the photos are in a single folder and have been appropriately edited in Adobe Lightroom. The editing process workflow can be learned about at brilliantimagery.org

Example: Smooth the exposure transitions but nothing else.

from brilliantimagery.sequence import Sequence

sequence = Sequence('path/to/folder/of/images')

sequence.ramp_exposure([0.25, 0.25, 0.5, 0.5])

Example: Stabilize the image sequence.

from brilliantimagery.sequence import Sequence

sequence = Sequence('path/to/folder/of/images')

sequence.stabilize([0.25, 0.25, 0.5, 0.5])

Example: Stabilize the image sequence and smooth all transitions.

from brilliantimagery.sequence import Sequence

sequence = Sequence('path/to/folder/of/images')

sequence.ramp_and_stabilize([0.25, 0.25, 0.5, 0.5])

A class used to represent a sequence of images and process them as such.

The two primary objectives are to stabilize shaky image sequences and to smooth transitions between different settings adjusted in photo editing software such as exposure and contrast.

Stabilization is accomplished by adjusting each images crop. Additionally, it’s assumed that each image is cropped in the same way so it’s best practice to copy the first images crop adjustment and paste them to the rest of the images.

Transitions are smoothed or ramped based ok “key frames” or reference frames that the interstitial frames are based off of by linearly extrapolating between key frames. Key frames are denoted by rating them with 3 stars.

brilliantimagery.sequence.Sequence.get_reference_image(self, rectangle=[0, 0, 1, 1], sub_image_type='thumbnail', index_order='cxy')

Gets a reference image for the sequence.

The first image in the image sequence is used as the reference.

Parameters
  • rectangle (list[int or float]) –

    The bounding box of the portion of the image that’s to be rendered. In the format X1, Y1, X2, Y2 where:

    • X1 is the x position of the top left corner,

    • Y1 is the y position of the top left corner,

    • X2 is the x position of the bottom right corner,

    • Y2 is the y position of the top right corner.

    The numbers should be in the range 0 - 1, representing the percent of the way across the image that the position is.

  • sub_image_type (str) – ‘thumbnail’ or ‘RAW’ depending on which is to be rendered. If no thumbnail is embedded within the image then the raw image will be rendered.

  • index_order (str) – The order of the array indexes. The two

options are ‘cxy’ and ‘yxc’.

  • ‘cxy’ equates to:

    index 0 being color channel, index 1 being pixel x position, index 2 being pixel y position

  • ‘yxc’ equates to:

    index 0 being pixel y position, index 1 being pixel x position, index 2 being color channel

Returns: A 3D float array holding the rendered image where each array index represents the information specified by the ‘index_order’ attribute.

brilliantimagery.sequence.Sequence.ramp(self, rectangle)

Ramps all user edited settings.

Returns

None

brilliantimagery.sequence.Sequence.ramp_and_stabilize(self, rectangle)

Ramps all user edited setting and stabilizes the sequence.

Returns

None

brilliantimagery.sequence.Sequence.ramp_exposure(self, rectangle)

Ramps the image exposure but nothing else.

Returns

None

brilliantimagery.sequence.Sequence.ramp_exposure_and_stabilize(self, rectangle)

Ramps only exposureand stabilizes the sequence.

Returns

None

brilliantimagery.sequence.Sequence.ramp_minus_exmpsure(self)

Ramps the edited image setting other than the exposure.

Won’t adjust the exposure and is faster then also ramping exposure since image rendering isn’t required.

Returns

None

brilliantimagery.sequence.Sequence.ramp_minus_exposure_and_stabilize(self, rectangle)

Ramps all setting other than exposure and stabilizes the sequence.

Returns

None

brilliantimagery.sequence.Sequence.save(self)

Saves each images ramp or crop changes.

Returns

None

brilliantimagery.sequence.Sequence.stabilize(self, rectangle, keep_brightness=False)

Stabilizes the image sequence but adjusts nothing else.

Returns

None