jvconnected.ui.models.waveform
Functions used by jvconnected.ui.models.devicepreview.CameraPreview
to generate waveform display.
Note
This module is experimental and the math involved is most assuredly incorrect. It should not be used where correctness is required.
Waveform Functions
- jvconnected.ui.models.waveform.get_waveform_arr(rgb_arr: RGBArrayF) WFMArray [source]
Calculate a waveform array as a set of xy points
The values for
'xpos'
and'ypos'
in the result represent the waveform’s points for each line of the input image where'ypos'
is the luma component. The'yprime'
field is the original \(Y'\) value and'ypos'
has the “footroom” of \(16/255\) subtracted from it. All fields are normalized (ranging from 0 to 1).
- jvconnected.ui.models.waveform.get_waveform_qimage(qimg: QImage) WFMArray [source]
Calculate a waveform array from a
QtGui.QImage
usingget_waveform_arr()
Image I/O Functions
- jvconnected.ui.models.waveform.qimg_to_rgb_arr(qimg: QImage) RGBArrayF [source]
Convert a
QtGui.QImage
to anRGBArrayF
- jvconnected.ui.models.waveform.img_arr_to_qimg(img_arr: RGBArray, output_rect: Optional[QRect] = None) QImage [source]
Convert the given
RGBArray
to aQtGui.QImage
- Parameters
img_arr (
RGBArray
) – The array to convert(class (output_rect) – QtCore.QRect, optional): If given, the result will be scaled to this size
Graticule Functions
- jvconnected.ui.models.waveform.get_graticules(rect: QRect) Tuple[Dict[float, float], Dict[float, QLineF]] [source]
Get a set of graticules scaled to fit within the given
QtCore.QRect
The scale ranges from -20 to 120 (ire) in increments of 10. An extra value of 7.5 ire is included (NTSC setup level)
- jvconnected.ui.models.waveform.paint_graticules(painter: QPainter, rect: QRect) Tuple[Dict[float, float], Dict[float, QLineF]] [source]
Draw graticules and text markers using the QPainter api
Graticules are calculated using
get_graticules()
then drawn on the givenQtGui.QPainter
. IRE value labels are then drawn alternating on the left and right sides- Parameters
painter (
QtGui.QPainter
) – The QPainter to draw withrect (
QtGui.QRect
) – The bounding box to use for drawing
- Returns
ire_vals (dict) – A mapping of ire values to their normalized positions
lines (dict) – A mapping of
QtCore.QLineF
objects with their ire values as keys
- Return type
Types
- jvconnected.ui.models.waveform.RGBArray
3d array of
np.uint8
with shape(height, width, color)
(sorted as RGBA)The values are 8-bit (ranging from 0 to 255)
alias of
ndarray
- jvconnected.ui.models.waveform.RGBArrayF
3d array of floats with shape
(height, width, color)
(sorted as RGB)The values are normalized (ranging from 0 to 1)
alias of
ndarray
- jvconnected.ui.models.waveform.WFMArray
2d array using the
WFM_dtype
with shape(height, width)
alias of
ndarray
- jvconnected.ui.models.waveform.WFM_dtype = dtype([('yprime', '<f8'), ('xpos', '<f8'), ('ypos', '<f8')])
A structured data type for waveform data
- Parameters
yprime –
np.float64
containing the result ofget_yprime_rgb()
xpos –
np.float64
containing the element’s x-axis position normalized to the range of 0 to 1ypos –
np.float64
containing the element’s y-axis position normalized to the range of 0 to 1. This is calculated as \(Ypos = Yprime - (16/255)\)