Vision and media
Images, video, interpretation, capture, and synchronized media.
Examples
oa
Types
10 members
Synchronized playback session over independent audio and video owners. The caller ticks video on the Runtime-owning thread. During the audio segment, the device output clock paces decoded video. The host clock covers silent lead-in and the tail after audio drains. A presented native frame retains its decoder backing until it is replaced and any external GPU consumers retire.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Types
10 members
Synchronized playback session over independent audio and video owners. The caller ticks video on the Runtime-owning thread. During the audio segment, the device output clock paces decoded video. The host clock covers silent lead-in and the tail after audio drains. A presented native frame retains its decoder backing until it is replaced and any external GPU consumers retire.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
Open both tracks paused, with the first video frame decoded. Errors Requires a supported video stream, both track sources, and an audio output configuration that can play the selected PCM.
4 members
11 members
oa
Types
101 members
Dense pixels with explicit axis-order and channel-order semantics. Image composes a Matrix instead of erasing its numeric dtype and storage behavior. Construction validates all metadata once; the matrix is thereafter exposed immutably so the image contract cannot be invalidated.
12 members
Stateful hardware decoder for one demuxed video stream. The Experimental codec paths accept progressive H.264 Baseline/Main/High, H.265 Main, AV1 Main 8-bit 4:2:0 without film grain, or VP9 Profile 0 8-bit 4:2:0. AVC and HEVC access units contain one complete slice per picture; admitted AV1 and VP9 access units may contain hidden and show-existing pictures. Host-planar and retained native output are synchronous; Vulkan handles and queue ownership remain private.
Source7 members
Stateful packet source for one local video track. Metadata is bounded and validated at open. Indexed containers read only the current compressed sample; MPEG-TS assembles one bounded PES at a time. H.264/H.265 length-prefixed samples are normalized to Annex-B and codec parameter sets are prepended to the first keyframe after open or seek.
Source12 members
Stateful hardware encoder session for H.264 High or H.265 Main. One encoder owns a private Vulkan Video encode session, per-slot NV12 input pictures, and the RGBA→NV12 conversion on the selected Runtime’s queues. Frames enter as packed RGBA8 bytes sized exactly visible_extent().width * visible_extent().height * 4; conversion, GOP cadence, rate control, DPB management, and Annex-B framing stay private. Every emitted EncodedVideoPacket is one access unit; keyframe packets carry the session’s cached SPS/PPS (and VPS for H.265) parameter sets so each random-access point is self-describing. encode waits for the submitted frame and returns its packet. flush waits for every outstanding encode job and drains the remainder — required before close when asynchronous submissions left frames in flight.
Source24 members
One timestamped video frame with retained storage and readiness semantics. The admitted packed-image path retains the backing Image, which in turn retains its crate::Matrix storage and exact producer readiness. Cloning a frame shares that retained value; it does not copy pixels or manufacture a second completion event.
10 members
Stateful streaming MP4 muxer for H.264/H.265 and optional PCM-S16 audio. Media payload is written as packets arrive. finalize appends the movie sample tables and closes the file. close deliberately abandons an unfinished file. Drop only releases the open file handle; it never manufactures a movie trailer or reports success.
Source25 members
Stateful local video player composed from VideoDemuxer and VideoDecoder. open decodes through the first display-order frame, so current_frame is immediately available on success. Timing controls do not create a second decoder or runtime owner; all hardware work remains inside the supplied Runtime-owned decoder session.
9 members
Stateful streaming MP4 recorder for hardware-encoded H.264/H.265 video. write_rgba submits one packed RGBA8 frame asynchronously and muxes every packet the slot ring has completed; finalize drains the remaining encoder jobs and closes the container. Audio chunks arriving before the first video frame are buffered until the first video presentation timestamp establishes the shared timeline.
SourceEnums
Functions
Add one image to a running accumulation image elementwise, following accumulate. Both images must share shape, layout, and format; the result is a fresh F32 image, not an in-place update. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format.
Blend an image into a running average as input * alpha + accumulator * (1 - alpha) per element, following accumulateWeighted. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format and alpha is finite.
Threshold against a local Gaussian-weighted mean minus c.
Threshold against the local arithmetic mean minus c.
Blend two equal semantic images using left * (1-alpha) + right * alpha.
Map a single-channel FP32 image to RGB through a colormap. Each luminance value is clamped to [0, 1] and mapped by the admitted analytic colormap definition (Jet, Hot, Hsv, or Rainbow) to an RGB triplet, producing a three-channel Rgb image per plane following the applyColorMap contract. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW with a single channel.
Average an odd rectangular neighborhood up to 31×31.
Brute-force Hamming descriptor matching: for each row of query, scan every row of train and record the two smallest XOR popcount distances. Both inputs are U8 [N, D] matrices sharing D. Returns an F32 [N_query, 4] matrix whose rows are (best_index, best_distance, second_index, second_distance), mirroring BFMatcher.knnMatch(k=2) on NORM_HAMMING. Rows with fewer than two candidates fill unused columns with -1. Errors Returns an error unless both inputs are nonempty U8 matrices with identical trailing descriptor width and at least one row each.
Apply a bilateral neighborhood filter.
Apply value * contrast + brightness.
Back-project a per-plane U32 histogram onto an FP32 image. Each pixel is quantized with the calc_hist rule over [lower, upper) into bins buckets taken from the histogram’s last dimension; the output pixel carries the histogram count as an FP32 value, or 0.0 when the source falls outside the range. Histogram leading dimensions must equal the image’s leading plane dimensions, following calcBackProject. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW, the histogram is a nonempty U32 Matrix of matching leading shape, lower/upper are finite with lower < upper, and all sizes fit the shader ABI.
Accumulate a per-plane histogram over an FP32 NCHW or CHW image. Each (batch, channel) plane contributes one row of bins buckets to the U32 result whose leading dimensions mirror the image; [B,C,H,W] and [C,H,W] inputs produce [B,C,bins] and [C,bins] results. Values below lower or at or above upper are ignored; in-range values map uniformly onto [0, bins). The accumulator is cleared inside the operation, so a captured plan replays the same counts. Errors Returns an error unless bins is in 1..=256, lower and upper are finite with lower < upper, the image is nonempty FP32 NCHW/CHW, and all sizes fit the shader ABI.
Return whether this build can decode codec.
Return whether this build can encode codec.
Canny edge detection per plane: 3x3 Sobel gradient magnitude, non-maximum suppression along the quantized gradient direction, double thresholding, and bounded hysteresis relaxation. Pixels at or above high_threshold are strong edges; pixels at or above low_threshold are weak and are kept only when 8-connected to a strong edge. hysteresis_passes bounds the relaxation passes (edge chains longer than the bound are cut); zero selects height + width per plane. Output planes carry 1.0 on detected edges and 0.0 elsewhere. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and both thresholds are finite with 0 <= low_threshold <= high_threshold.
Extract a centered region with the requested exact extent.
Reorder one to four channels and explicitly assign the resulting format. order[c] selects the source channel for output channel c. The output format must have the same channel count as the input so pixel data and semantic metadata cannot diverge.
Contrast-limited adaptive histogram equalization per plane. Each plane is split into tile_width x tile_height tiles, quantized into 256 uniform buckets over [0, 1], clipped at clip_limit times the per-bin average with the excess spread uniformly, and remapped through bilinear-interpolated tile lookup tables following the CLAHE contract. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW, clip_limit is finite and positive, both tile extents are nonzero, and all sizes fit the shader ABI.
Clamp every pixel to the inclusive interval.
Apply one shared FP32 [3, 4] affine color transform to RGB channels.
Compare two same-shape U32 histogram matrices row by row. The last dimension is the bucket axis; every leading index is an independent row, so [B,C,bins] histograms produce a [B,C] FP32 score matrix. Correlation, chi-square, intersection, and Bhattacharyya follow the OpenCV compareHist formulas; degenerate rows return 0.0 rather than propagating a zero denominator. Errors Returns an error unless both inputs are same-shape nonempty U32 matrices of rank at least two on one runtime, and all sizes fit the shader ABI.
Composite two equal images with a clamped Gray or per-channel mask.
Connected-component labeling per plane, following connectedComponents: every pixel above threshold is a foreground candidate and receives a unique initial label; bounded min-label propagation merges neighbors under the selected connectivity (4 or 8). The U32 output carries plane x height x width labels with u32::MAX on background pixels. propagation_passes bounds label propagation (zero selects height + width per plane); components with diameters beyond the bound resolve to sub-components. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and threshold is finite.
Convert between three-channel RGB and BGR semantics, including identity.
Apply same-shape 2D cross-correlation with an odd FP32 kernel up to 31×31.
FAST corner response per plane on the radius-3 circle of 16 samples: for each pixel the score is the largest deviation t such that arc_length contiguous circle samples are all brighter than center + t or all darker than center - t, zero when no such arc exists. Pixels within 3 of the border score 0.0. The response map shares the input geometry; non-maximum suppression and thresholding select candidate keypoints. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and arc_length is in 9..=16.
Per-pixel corner response over each plane: 3x3 Sobel gradients feed windowed second moments M = [sum Ix^2, sum IxIy; sum IxIy, sum Iy^2] inside a block_size x block_size box. Harris emits det(M) - k * trace(M)^2; MinEigen emits the smaller eigenvalue of M (Shi-Tomasi). Borders reflect101 like cornerHarris. The response map shares the input geometry; combine with a local max pass for candidate keypoints. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, k is finite, and block_size is odd and at least 3.
Extract a region, clipping its right and bottom edges to the source extent.
Convert an FP32 image between color spaces following cvtColor. The conversion code owns the color-space contract, matching OpenCV’s COLOR_* pairs: channel-ordered inputs admit the Rgb/Bgr sources and Gray admits the gray sources. The output carries Gray for luminance results, Rgb for gray-to-color results, and the input format otherwise; the color-space interpretation of three-channel results follows the conversion code exactly as it does for cv::Mat. HSV keeps OpenCV’s F32 ranges (H [0, 360], S/V [0, 1]); Lab uses the D65 XYZ intermediate (L [0, 100], a/b signed); YCrCb applies the F32 0.5 chroma offset. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW and the source channel count matches the conversion.
Decode a JPEG, PNG, WebP, BMP, TGA, or TIFF file and upload normalized planar FP32 pixels. The result is one NCHW image shaped [1, channels, height, width]. This is a synchronous host codec boundary followed by device upload. Errors Returns an error for an empty path, filesystem failure, unsupported or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure. This variant decodes on this thread’s default runtime. An runtime initialization failure is returned before decoding starts.
Decode a JPEG, PNG, WebP, BMP, TGA, or TIFF file and upload normalized planar FP32 pixels on a particular runtime. This is the decode_file contract evaluated on runtime instead of this thread’s default runtime. Errors Returns the same errors as decode_file.
Decode JPEG, PNG, WebP, BMP, TGA, or TIFF bytes and upload normalized planar FP32 pixels. The requested output format may be Gray, Rgb, or Rgba. The result is one NCHW image shaped [1, channels, height, width]. Errors Returns an error for empty, unsupported, or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure. This variant decodes on this thread’s default runtime. An runtime initialization failure is returned before decoding starts.
Decode JPEG, PNG, WebP, BMP, TGA, or TIFF bytes and upload normalized planar FP32 pixels on a particular runtime. Errors Returns an error for empty, unsupported, or malformed media, unsupported requested format, checked-size overflow, or device allocation/upload failure.
Dilate with an odd rectangular structuring element up to 31×31.
Distance transform per plane, following distanceTransform: every pixel above threshold measures the chamfer distance to the nearest background pixel. DistanceType::L1 uses a 4-neighborhood with unit weights (exact Manhattan distance); DistanceType::L2 uses an 8-neighborhood with weights 1 / sqrt(2), the classic 3x3 chamfer approximation. The F32 output carries plane x height x width distances, zero on background. propagation_passes bounds the relaxation (zero selects height + width per plane, the worst-case propagation distance). Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and threshold is finite.
Draw a circle ring or disk over a copy of the input, following circle: (cx, cy) is the center in pixel units. A positive thickness draws a ring whose band is that many pixels wide around radius; a negative thickness fills the disk. color applies to every plane. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, cx, cy, radius, and color are finite, radius is positive, and thickness is finite and nonzero.
Draw a straight segment over a copy of the input, following line: each pixel whose center lies within thickness / 2 of the (x1, y1)-(x2, y2) segment takes color; all other pixels copy the input. Coordinates are continuous pixel units and color applies to every plane. No anti-aliasing is applied. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, all coordinates and color are finite, and thickness is positive and finite.
Draw a rectangle border or fill over a copy of the input, following rectangle: (x, y) gives the top-left corner in pixel units and width/height the extent. A positive thickness draws a border band that many pixels wide measured inward from the rectangle edge; a nonpositive thickness fills the rectangle. color applies to every plane. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, all coordinates and color are finite, width and height are positive, and thickness is finite and nonzero.
Read normalized planar FP32 pixels and encode one still-image bitstream. quality is used by the lossy JPEG and WebP encoders and must be in [1, 100] for those codecs. This is an explicit blocking host-observation boundary. Errors Returns an error for Auto, unsupported image metadata, invalid quality, readback failure, checked-size overflow, or codec failure.
Equalize a normalized FP32 image histogram per (batch, channel) plane. Pixel values are quantized into 256 uniform buckets over [0, 1], the per-plane cumulative distribution is spread back over [0, 1] following the equalizeHist contract, and the result keeps the input layout and format. Values outside [0, 1] clamp into the edge buckets. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW and all sizes fit the shader ABI.
Fill the intersection of a rectangle and the image with one finite value.
Erode with an odd rectangular structuring element up to 31×31.
Least-squares estimate the 2x3 affine transform mapping source points to destination points, matching estimateAffine2D without refinement. Both inputs must be [N, 2] F32 matrices with N >= 3 equal rows. Errors Returns an error unless both inputs share an [N, 2] F32 shape with N >= 3 and the normal equations are nonsingular.
Non-local means denoising over a search window, following cv::fastNlMeansDenoising. Each output pixel is the weighted mean of samples in the (search_window)^2 neighbourhood with weights exp(-d / h^2), where d is the patch SSD over an odd template_window normalized by its area; the center weight equals the largest neighbour weight so a uniform region stays untouched. Returns an image with identical shape, layout, and format. Errors Returns an error unless input is a nonempty FP32 NCHW/CHW image, h is finite and positive, and both windows are odd and at least 3.
Fill a polygon over a copy of the input, following fillPoly: the points matrix carries [N, 2] vertex coordinates and every pixel whose center falls inside the even-odd winding of the polygon takes color. color applies to every plane. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, points is an FP32 [N, 2] matrix with at least 3 vertices on the same runtime, and color is finite.
External contour extraction per plane, following findContours with RETR_EXTERNAL semantics: foreground pixels above threshold are labeled as connected components under the selected connectivity, each component’s minimum-index boundary pixel seeds a Moore-neighbor trace that emits an ordered (x, y) point list. Returns an F32 [planes, max_contours, max_points, 2] point matrix and a U32 [planes, max_contours] length matrix; unused slots stay zero. max_points bounds each contour (zero selects 4 * (height + width); longer contours truncate), and max_contours bounds the per-plane contour count. propagation_passes bounds component labeling (zero selects height + width). Contour order and slot assignment are unspecified across planes. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, threshold is finite, and max_contours is nonzero.
Flip an image horizontally, vertically, or along both axes.
Floating-range flood fill per plane, following floodFill: the pixel at (seed_x, seed_y) takes value, and each unmarked pixel joins the region when a connected neighbor already belongs and the candidate’s original value lies within [neighbor - lo_diff, neighbor + up_diff] of that neighbor’s original value. Propagation runs a fixed number of relaxation passes (zero selects height + width); regions whose flood diameter exceeds the bound fill partially. The output is a filled copy of the input; unmarked pixels keep their values. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, the seed is in bounds, and value, lo_diff, and up_diff are finite with lo_diff >= 0 and up_diff >= 0.
Apply max(value, 0)^gamma * gain.
Apply a normalized Gaussian blur with replicate borders.
Add explicit-seed Philox Gaussian noise to every pixel.
Bounded goodFeaturesToTrack selection over a per-plane corner response map: pixels scoring above quality * plane_max survive radius suppression when no strictly stronger candidate lies within min_distance (ties break by lower linear index). Survivors claim atomic slots per plane up to max_corners; slot order is unsorted unlike OpenCV’s score-descending emission. Returns (keypoints, counts): an F32 [planes, max_corners, 3] matrix of (x, y, score) rows holding min(count, max_corners) valid entries followed by zeros, and a U32 [planes] survivor count matrix (may exceed max_corners when slots truncate). A max_corners of zero selects height * width per plane. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and both quality and min_distance are finite with quality in [0, 1] and min_distance >= 0.
Convert an RGB or RGBA image to Rec.709 grayscale.
Standard Hough line transform per plane, following HoughLines: pixels above edge_threshold vote into a (theta x rho) accumulator quantized by theta_step (degrees over [0, 180)) and rho_step. Accumulator cells reaching threshold votes that are strict local maxima in their 3x3 theta-rho neighborhood emit lines. The F32 output carries plane x max_lines x 3 rows of (rho, theta degrees, votes) in compacted unsorted order; unused rows are zero. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, edge_threshold/rho_step/theta_step are finite, rho_step/theta_step are positive, theta_step does not exceed 180, and max_lines is nonzero.
Probabilistic Hough segment transform per plane, following HoughLinesP: votes accumulate as in hough_lines, strict local-maxima cells above threshold emit candidate lines, and each candidate is walked along its direction to find the dominant contiguous edge run that tolerates gaps of up to max_line_gap pixels and reaches min_line_length. The F32 output carries plane x max_lines x 4 rows of (x1, y1, x2, y2) endpoints; line slots without a qualifying run are zero. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, edge_threshold/rho_step/theta_step are finite, rho_step/theta_step are positive, theta_step does not exceed 180, min_line_length is nonnegative, and max_lines is nonzero.
Produce true_value for values inside the inclusive interval and zero outside it.
Compute the per-plane summed-area table of an FP32 image. Following the integral contract, the result is a (height + 1) x (width + 1) FP32 Matrix per (batch, channel) plane whose zero row and column border the inclusive prefix sums: element (y, x) holds the sum over source pixels [0, y) x [0, x). The leading dimensions are preserved ahead of the enlarged spatial extents. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW, enlarged extents stay nonzero, and all sizes fit the shader ABI.
Invert every value around max_value.
Invert a 2x3 affine transform matrix, matching invertAffineTransform. The input must be a [2, 3] F32 matrix with a nonsingular linear block. Errors Returns an error unless matrix is a [2, 3] F32 matrix whose 2x2 linear block is nonsingular.
Apply the four-neighbor discrete Laplacian.
Slide a single-plane template over each image plane and write the per-position match score to a Matrix, following matchTemplate. The template’s channel count must equal the input’s; the output carries the input’s leading plane dimensions plus (height - th + 1) x (width - tw + 1) score elements computed by a serial per-position reduction over the template window. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with matching channel counts, a single-plane template no larger than the image planes, and sizes that fit the shader ABI.
Select the median of an odd square neighborhood up to 15×15.
Compute the ten spatial moments m00, m10, m01, m20, m11, m02, m30, m21, m12, m03 per image plane through a serial per-plane reduction, following cv::moments. The result Matrix carries the image’s leading plane dimensions plus a final extent-10 moment dimension. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and all sizes fit the shader ABI.
Return the morphological closing minus the source.
Dilate and then erode with the same rectangular element.
Return dilation minus erosion.
Erode and then dilate with the same rectangular element.
Return the source minus its morphological opening.
Generate deterministic Philox noise matching input’s shape and layout. The same (seed, distribution, amplitude) triple always produces the same noise tensor. The result carries input’s layout and format so it can be mixed back into the image or an augmentation chain. Errors Returns an error when amplitude is negative or non-finite, or noise generation/allocation fails.
Apply (pixel - mean[channel]) / std[channel] to up to three channels.
Dense Farneback optical flow over a 2x image pyramid, following calcOpticalFlowFarneback. Each level expands both frames into polynomial coefficient maps through two separable weighted-least-squares passes (flow_expand_v then flow_expand_h), then relaxes the flow field with iterations Jacobi flow_update dispatches over a 2 * window + 1 averaging neighbourhood. The coarsest level starts from a zero field; finer levels initialize from the 2x-upsampled coarser solution. window is the half-window radius of the update averaging neighbourhood and poly_n the half-support of the gaussian-weighted polynomial fit. Returns the F32 [planes, 2, H, W] flow field at level-0 resolution with x displacement in channel 0 and y displacement in channel 1. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, levels, window, iterations, and poly_n are >= 1, poly_sigma is finite and positive, and the coarsest level still fits the polynomial support.
Sparse Lucas-Kanade optical flow with image pyramids, following calcOpticalFlowPyrLK. Each pyramid level runs one flow_lk_refine dispatch from the coarsest level to level 0 over 2 * window + 1 windows with the same point set applied to every image plane; the tracked estimate carries between levels in a [planes, N, 2] state buffer and the last level writes status and error maps. points is an F32 [N, 2] matrix of (x, y) source positions in level-0 pixel coordinates. window is the half-window radius. Returns (next_points, status, error): the tracked F32 [planes, N, 2] positions, an F32 [planes, N] found/lost mask, and an F32 [planes, N] RMS patch-residual error; status 0 rows carry the final unconverged estimate. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, points is a nonempty F32 [N, 2] matrix, levels, window, and iterations are >= 1, min_eigen is finite and positive, and the coarsest level still fits the full window.
Bounded ORB keypoint + steered rBRIEF descriptor pipeline, following ORB::detectAndCompute. Each pyramid level runs the existing corner_fast + good_features_to_track stages (FAST-9 response, quality-thresholded radius suppression), then a describe stage computes the intensity-centroid orientation over a 31x31 patch and a 256-bit steered BRIEF descriptor using the OpenCV bit_pattern_31_ test pairs. Scale factor is 2x per level via pyr_down. Returns (keypoints, descriptors, counts): an F32 [planes, max_features, 6] matrix of (x, y, angle_radians, score, level, size) rows in level-0 coordinates, a U32 [planes, max_features, 8] matrix of descriptor words, and a U32 [planes] claimed-slot count (may exceed max_features). Slot order is unordered across a level’s survivors. A max_features of zero selects height * width per plane. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, levels >= 1, edge >= 18 (rotated test-pair support), quality is in [0, 1], and min_distance is finite and >= 0.
Add asymmetric padding with an explicit border policy.
Solve the 3x3 perspective transform mapping four [x, y] source points to four destination points, matching getPerspectiveTransform. Both inputs must be [4, 2] F32 matrices. Errors Returns an error unless both inputs are [4, 2] F32 matrices yielding a nonsingular 8x8 system (no three collinear source points).
Quantize [low, high] to levels evenly spaced values using round-half-up.
Peak signal-to-noise ratio per image plane in decibels, following cv::PSNR: 10 * log10(peak^2 / mse) through a serial per-plane reduction, +inf when the planes match exactly. The result Matrix carries the image’s leading plane dimensions. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format and peak_value is finite and positive.
Halve an FP32 image with the pyrDown Gaussian-decimate contract. Each output pixel gathers the 5x5 [1, 4, 6, 4, 1] Gaussian neighborhood centered on the doubled source coordinate, following OpenCV’s BORDER_DEFAULT (reflect-101) edge rule. Output spatial extents are (extent + 1) / 2 per axis; layout and format are preserved. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW and all sizes fit the shader ABI.
Pyramid mean-shift edge-preserving smoothing, following cv::pyrMeanShiftFiltering. The image is downsampled max_level times with pyr_down; each level then runs a per-pixel mean-shift pass that, for up to five iterations, averages the (2*sp+1)^2 window samples whose channel-vector distance stays below sr and adopts that mean position and color, converging when the spatial shift drops under one pixel. Coarse-to-fine levels seed their starting color from the parent’s converged result. Channels participate as one color vector per plane pixel; returns an image with identical shape, layout, and format. Errors Returns an error unless input is a nonempty FP32 NCHW/CHW image with at most 4 channels, sp/sr are finite and positive, max_level is in [1, 4], and the coarsest level still fits the spatial window support.
Double an FP32 image with the pyrUp interpolate-blur contract. The source is upsampled by two with zero rows and columns at odd positions, then convolved with the 5x5 [1, 4, 6, 4, 1] kernel scaled by four, following OpenCV’s BORDER_DEFAULT (reflect-101) edge rule on the upsampled grid. Output spatial extents are 2 * extent per axis; layout and format are preserved. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW and all sizes fit the shader ABI.
Crop a width×height window at a seed-derived uniform offset. The offset is drawn uniformly over the valid top-left range from seed, keeping the crop itself a single recorded device operation. Errors Returns an error when the window is zero-sized or exceeds input, or the crop fails.
Randomly mirror input horizontally and/or vertically. p_horizontal and p_vertical are independent probabilities in [0, 1]. Both coin draws are derived from seed, so the same recipe flips the same way on every run. Errors Returns an error when either probability is outside [0, 1] or non-finite, or the flip fails.
Rotate input by a seed-derived quarter-turn: 0°, 90°, 180°, or 270°. Errors Returns the rotation error when dispatch fails.
Resample an image from an FP32 absolute-coordinate map shaped [1|batch, 2, output_height, output_width].
Per-pixel reprojection of a disparity map into 3D coordinates, following cv::reprojectImageTo3D. For each pixel it evaluates (X, Y, Z, W) = Q * [x, y, disparity, 1] with the row-major 4x4 F32 matrix q, then writes the normalized coordinates X/W, Y/W, Z/W. disparity must be F32 [planes, 1, H, W] (the stereo_bm output layout) and q F32 [4, 4]; the homogeneous divide is unguarded, so a degenerate last row surfaces as inf/NaN. Returns the F32 [planes, 3, H, W] coordinate map. Errors Returns an error unless disparity is F32 with shape [planes, 1, H, W] and q is F32 [4, 4] on the same runtime.
Resize an FP32 channel-first image while preserving its layout and format. NCHW and CHW storage are supported. Nearest sampling follows the donor OA floor-coordinate rule. Bilinear sampling uses half-pixel centers with align_corners = false. Area performs a coverage-weighted box average for downscales and pixel replication for upscales, matching INTER_AREA. Cubic uses the Keys a=-0.75 bicubic kernel over the 4x4 source neighborhood, and Lanczos uses the a=4 sinc kernel over the 8x8 source neighborhood with the filter widened by the inverse scale when downscaling, matching INTER_CUBIC and INTER_LANCZOS4. The call records work asynchronously and returns an Image immediately. Reading its backing matrix is an explicit submission and observation point. Errors Returns an error for a zero target extent, an empty source extent, a dtype or layout outside the admitted checkpoint, checked-size overflow, or a runtime recording failure.
Bilinearly resize and normalize in one semantic and executable operation.
Rotate clockwise by a multiple of 90 degrees.
Build the 2x3 rotation+scale matrix mapping about center, matching getRotationMatrix2D: alpha = scale * cos(angle), beta = scale * sin(angle) with angle in degrees counterclockwise. Errors Returns an error when any parameter is non-finite.
Replace a seeded fraction of pixels with salt or pepper values.
Encode an Image using the codec inferred from the output extension and save it. Supported extensions are .jpg, .jpeg, .png, .webp, .bmp, and .tga. This is an explicit blocking device-readback and filesystem boundary. Errors Returns an error for an empty or unsupported path, invalid image or quality, readback or encoding failure, or a host filesystem failure.
Encode and save one exact packed RGBA8 host image. This is the host sink used by render sessions after their own explicit completion and readback protocol has produced packed bytes. Errors Returns an error for an empty or unsupported path, zero or overflowing dimensions, a mismatched byte count, invalid quality, codec failure, or a host filesystem failure.
Compute one first-order Scharr derivative.
Blend a class palette over an RGB/RGBA image using an I32 label map.
Apply horizontal and vertical odd FP32 vector kernels up to length 31.
Apply a nonnegative four-neighbor sharpening amount.
Compute one first-order Sobel derivative.
Invert values at or above threshold around max_value.
Global structural similarity per image plane through a serial per-plane reduction of means, variances, and covariance with the standard K1=0.01, K2=0.03 constants over a [0, 1] dynamic range, following the SSIM index of Wang et al. rather than OpenCV’s windowed map. The result Matrix carries the image’s leading plane dimensions. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format.
Block-matching stereo disparity over the horizontal search range [0, num_disparities), following cv::StereoBM. The stereo_sad pass builds a [planes, num_disparities, H, W] sum-of-absolute-differences volume over an odd block_size window; stereo_wta then keeps the per-pixel argmin, applies the uniqueness percent runner-up margin test (0 disables), and refines the winner with a symmetric parabola on the neighbouring costs. Pixels outside the border region where the matching window fits for every disparity, and uniqueness losers, are marked -1; the valid range otherwise starts at 0. Returns the F32 [planes, 1, H, W] disparity map. Errors Returns an error unless both images are nonempty FP32 NCHW/CHW images with identical shape, layout, and format, num_disparities >= 1, block_size is odd and >= 3, and the image fits the combined block and disparity support.
Binary-threshold an FP32 image with a histogram-selected level. Each (batch, channel) plane is quantized into 256 uniform buckets over [0, 1]; the Otsu or Triangle method selects one threshold per plane following the OpenCV THRESH_OTSU/THRESH_TRIANGLE contracts, and pixels strictly above it produce max_value while all others produce 0.0. Returns the thresholded image together with the per-plane threshold Matrix shaped like the leading dimensions. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW, max_value is finite, and all sizes fit the shader ABI.
Replace values above threshold with max_value and all others with zero.
Replace values at or below threshold with max_value and all others with zero.
Replace values at or below threshold with zero.
Replace values above threshold with zero.
Truncate values above threshold.
Apply an unsharp mask using a Gaussian detail estimate.
Apply an inverse FP32 2x3 affine transform to an image.
Apply an inverse FP32 3x3 perspective transform to an image.
Warp each image plane to polar coordinates about a center, following warpPolar: output row y is the angular axis [0, 2pi) and column x is the radial axis — x / width * max_radius under Linear or max_radius^(x / width) under SemiLog. Source samples gather with the admitted interpolation and border policy. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, the center and radius are finite with max_radius > 0, the output extent is nonzero, border_value is finite, and all sizes fit the shader ABI.
Types
101 members
Dense pixels with explicit axis-order and channel-order semantics. Image composes a Matrix instead of erasing its numeric dtype and storage behavior. Construction validates all metadata once; the matrix is thereafter exposed immutably so the image contract cannot be invalidated.
Enums
Sampling behavior for coordinates outside an image.
Constant · Replicate · Reflect · Reflect101 · Wrap
Color-space conversion code used by cvt_color.
RgbToGray · BgrToGray · GrayToRgb · RgbToHsv · BgrToHsv · HsvToRgb · HsvToBgr · RgbToLab · BgrToLab · LabToRgb · LabToBgr · RgbToYcrcb · BgrToYcrcb · YcrcbToRgb · YcrcbToBgr
Row-wise histogram comparison metric used by compare_hist.
Correlation · ChiSquare · Intersection · Bhattacharyya
Logical channel order carried by an Image. Scalar width and numeric representation remain properties of the backing Matrix; this format describes channel meaning only.
Gray · GrayAlpha · Rgb · Rgba · Bgr · Bgra
Template-match score metric used by match_template.
Sqdiff · SqdiffNormed · Ccorr · CcorrNormed · Ccoeff · CcoeffNormed
Functions
Alpha-composite front over back plane-by-plane; alpha is 0-255. Both frames must share format, extent, and runtime. Each component blends with rounding (front*a + back*(255-a) + 127) / 255. Errors Returns an error for non-device-planar inputs, mismatched frames, or a runtime recording failure.
Convert a frame between Nv12 and Yuv420Planar8 plane layouts without changing content, extent, or component ranges. Each plane is repacked by a resample dispatch at identity mapping; NV12’s interleaved chroma pair splits into two dispatches (or merges from two) through per-component stride selection. Errors Returns an error for a non-device-planar frame, a same-format or non-admitted target, or a runtime recording failure.
Convert a frame’s component range between limited and full. The frame’s color metadata is updated to the target range; Unspecified input uses BT.709 limited as the source. Same-range requests return a copy at identity. Errors Returns an error for a non-device-planar frame or a runtime recording failure.
Extract a luma-space region; chroma extents follow the format’s rules. x and y must be even so chroma stays subsample-aligned. Errors Returns an error for a non-device-planar frame, odd offsets, or a region outside the visible extent.
Emit borrowed NAL payloads as canonical four-byte-start-code Annex-B. Errors Returns an error when the output size overflows or host allocation fails.
Copy the first H.264 picture parameter set payload.
Copy the first H.265 picture parameter set payload.
Copy the first H.264 sequence parameter set payload.
Copy the first H.265 sequence parameter set payload.
Copy the first H.265 video parameter set payload.
Mirror a frame along one axis in place-size output. Errors Returns an error for a non-device-planar frame.
Retain a render Texture as one timestamped video frame. The returned frame shares a buffer-backed Texture’s packed RGBA8 storage, semantic identity, and exact Matrix producer readiness. It performs no pixel copy, submission, wait, or Image conversion. Render targets require from_texture_with_ready so their producer completion is not lost. Errors Returns an error for a render-target-backed Texture.
Retain a texture and its exact producer completion in one video frame. This is the render-target path: it shares the texture and event without a readback, wait, or pixel copy. The event must belong to the texture’s Runtime. Errors Returns an error when ready comes from a different Runtime.
Inspect one raw access unit or the first frame of an IVF byte stream. Errors Returns an error for malformed IVF framing, invalid OBU structure, count overflow, or an empty frame payload.
Convert an MP4 length-prefixed H.264/H.265 sample into Annex-B NAL units. Errors Returns an error for a length width other than 1, 2, or 4, a truncated length field, a zero-sized NAL unit, arithmetic overflow, or payload overrun.
Aspect-preserving resize into a fixed extent with a constant fill. fill is a YUV code triplet in the frame’s component range. Errors Returns an error for a non-device-planar frame or a zero extent.
Draw rectangles into a new device-planar frame. The base frame is copied once at identity; each box then writes its scaled region on luma and each chroma component with exclusive single-component dispatches. border draws a hollow ring of that width in luma pixels instead of filling. Errors Returns an error for a non-device-planar frame, a box outside the visible extent, or a runtime recording failure.
Stencil fill onto a frame wherever the mask’s luma byte is nonzero. mask must be a device-planar frame of the same luma extent whose luma plane is the stencil. Chroma components apply the mask at chroma resolution; edge columns under odd extents follow the chroma rounding. Errors Returns an error for non-device-planar inputs, mismatched extents, or a runtime recording failure.
Per-component stencil from a device-resident score map: where the scores value at the mask coordinate is at or above threshold the fill code is written, otherwise the base byte is copied. scores must be an F32 matrix with exactly width * height elements at the frame’s luma extent; chroma planes sample it at scaled luma coordinates. fill is the Y, U, V code triple written where the score passes. The score map stays on the device — this is the GPU-resident overlay edge for segmentation-style model output inside a captured plan. Errors Returns an error if the frame is not device-planar, if the score matrix is not F32 or does not match the luma extent, if the runtimes differ, or if the region arithmetic overflows.
Extend a frame with a constant border. fill is a YUV code triplet in the frame’s component range. left and top must be even so chroma stays subsample-aligned. Errors Returns an error for a non-device-planar frame, odd offsets, or extent overflow.
Parse one AV1 frame or frame-header OBU payload against explicit reference state. Errors Returns an error for truncated or inconsistent syntax and for donor features that are not yet represented: frame IDs, decoder-model removal timing, short reference signaling, non-uniform tiles, and film grain.
Split one raw AV1 access-unit payload into borrowed OBUs. Errors Returns an error for forbidden/reserved header bits, truncated extensions or LEB128 sizes, payload overruns, empty input, and arithmetic overflow.
Parse one AV1 sequence-header OBU payload. Pass Av1Obu::payload from an OBU whose type is Av1ObuType::SequenceHeader. The returned representation is independent of Vulkan’s standard-video C structures and retains the stream metadata needed to create exact backend profiles and session parameters. Errors Returns an error when the payload is empty or truncated, declares a reserved profile, carries an invalid frame-ID length, or encodes a chroma layout outside the AV1 profile rules.
Parse the tile ranges carried by one frame or tile-group OBU. Returned offsets are relative to the access-unit byte slice originally passed to super::parse_av1_obus, matching Vulkan Video’s source-buffer offset convention. Errors Returns an error for an incompatible OBU type, missing payload, invalid tile count/range/size width, truncated size fields, payload overruns, or offsets that do not fit Vulkan’s 32-bit tile arrays.
Parse one raw H.264 PPS NAL unit without an Annex-B start code.
Parse one raw H.264 coded-slice NAL using its resolved SPS and PPS. The returned picture-order-count field contains the coded LSB for POC type zero. POC types one and two require prior-picture state and therefore return None; the decoder session must derive the final POC rather than inventing a stateless approximation.
Parse one raw H.264 SPS NAL unit without an Annex-B start code.
Parse one raw H.265 PPS NAL unit without an Annex-B start code.
Parse one raw H.265 coded-slice NAL using its resolved SPS and PPS. Dependent slice segments and inline inter-predicted short-term reference sets require additional retained state and fail with MissingCapability.
Parse one raw H.265 SPS NAL unit without an Annex-B start code.
Parse one raw H.265 VPS NAL unit without an Annex-B start code.
Split an Annex-B byte stream into borrowed H.264 NAL payloads. Both 00 00 01 and 00 00 00 01 start codes are recognized. Bytes before the first start code and empty units are ignored, matching the donor oa::FnVideo::parseNalAnnexB contract.
Query the selected device’s exact limits for one decoder profile. Extension advertisement alone does not prove that a particular profile, chroma layout, bit depth, or codec option is usable. This query presents the complete profile to Vulkan and returns MissingCapability when rejected. Errors Returns an error when the codec extension is unavailable, the exact profile is unsupported, or the Vulkan capability query fails.
Enumerate decoded-output and DPB image formats for one exact profile. Errors Returns an error when the profile or its codec extension is unsupported, a Vulkan enumeration fails, or the driver reports an unreasonable result size.
Query Vulkan Video queues and codec extensions on the Runtime’s selected device. This query reports both physical-device advertisement and whether Runtime creation enabled video queues, and whether at least one qualified codec session path exists. Errors Returns an error when Vulkan device-extension or queue-family enumeration fails.
Query exact H.264 or H.265 encoder limits without creating a session.
Enumerate encode-input and DPB formats for one exact profile.
Stretch a frame to a new extent in luma space; chroma planes follow. Errors Returns an error for a non-device-planar frame or a zero extent.
Rotate a frame ninety degrees clockwise. Errors Returns an error for a non-device-planar frame.
Join frames of matching cross-extent along one axis. Along-axis extents of all but the last frame must be even so chroma offsets stay subsample-aligned. Errors Returns an error for an empty batch, non-device-planar frames, mixed formats or cross-extents, odd alignment, or extent overflow.
Threshold a frame’s luma plane; chroma planes are copied unchanged. value >= threshold maps to high, otherwise low. Errors Returns an error for a non-device-planar frame or a runtime recording failure.
Convert one or more video frames into a single batched F32 Matrix. This is the only colorimetric YUV→RGB boundary in oa::video. Inputs must be device-planar frames with identical format, visible extent and resolved color metadata. I420, NV12, and P010 are admitted. Stage host planes with VideoFrame::upload_planes or VideoFrame::upload. The call records asynchronously and returns the output immediately. Reading it is an explicit submission and observation point. Errors Returns an error for an empty or mixed-geometry batch, an ineligible backing, a crop outside the visible region, zero output extents, an unsupported layout or bit depth, or a runtime recording failure.
Types
3 members
4 members
7 members
One borrowed AV1 OBU and its exact access-unit byte range.
Source3 members
One AV1 operating point declared by a sequence header.
Source8 members
Logical AV1 reference-map order hints and global-motion state supplied to a stateless frame parse.
Source5 members
10 members
One owned Annex-B video access unit with microsecond presentation timing.
Source3 members
H.264 VUI aspect-ratio syntax retained with an optional extended SAR.
Source3 members
H.264 hypothetical-reference-decoder parameters.
Source4 members
One decoded-reference-picture marking command from an H.264 slice header.
Source3 members
Parsed H.264 picture parameter set required by decode-session setup.
Source3 members
H.264 sequence- or picture-level scaling-list syntax in scan order.
Source5 members
3 members
3 members
4 members
One coded-picture-buffer entry in an H.265 HRD sub-layer.
Source4 members
H.265 decoded-picture-buffer limits for every temporal sub-layer.
Source4 members
H.265 hypothetical-reference-decoder parameters.
Source3 members
4 members
General H.265 profile-tier-level fields carried by a VPS.
Source4 members
Fully resolved H.265 scaling matrices in raster order. Prediction-mode references and diagonal coefficient walks are resolved by the parser, so backend lowering can copy these arrays without retaining bitstream-local prediction state.
Source3 members
4 members
One fully parsed H.265 short-term reference-picture set. Syntax masks are retained for standard-video lowering while delta_pocs contains the resolved candidate order required to parse a following inter-predicted set.
Source3 members
4 members
H.265 HRD syntax for one temporal sub-layer.
Source3 members
4 members
One VPS HRD table and the layer set to which it applies.
Source4 members
9 members
Borrowed H.264 NAL payload and decoded header fields. The payload starts at the NAL header byte and aliases the input Annex-B buffer. It does not include the three- or four-byte start code.
Source7 members
14 members
17 members
8 members
Decode-output and decoded-picture-buffer formats for one exact profile.
Source12 members
Stateful hardware decoder for one demuxed video stream. The Experimental codec paths accept progressive H.264 Baseline/Main/High, H.265 Main, AV1 Main 8-bit 4:2:0 without film grain, or VP9 Profile 0 8-bit 4:2:0. AVC and HEVC access units contain one complete slice per picture; admitted AV1 and VP9 access units may contain hidden and show-existing pictures. Host-planar and retained native output are synchronous; Vulkan handles and queue ownership remain private.
Source7 members
Stateful packet source for one local video track. Metadata is bounded and validated at open. Indexed containers read only the current compressed sample; MPEG-TS assembles one bounded PES at a time. H.264/H.265 length-prefixed samples are normalized to Annex-B and codec parameter sets are prepended to the first keyframe after open or seek.
Source17 members
24 members
5 members
8 members
Encode-input and reconstructed-picture formats for one exact profile.
Source6 members
12 members
Stateful hardware encoder session for H.264 High or H.265 Main. One encoder owns a private Vulkan Video encode session, per-slot NV12 input pictures, and the RGBA→NV12 conversion on the selected Runtime’s queues. Frames enter as packed RGBA8 bytes sized exactly visible_extent().width * visible_extent().height * 4; conversion, GOP cadence, rate control, DPB management, and Annex-B framing stay private. Every emitted EncodedVideoPacket is one access unit; keyframe packets carry the session’s cached SPS/PPS (and VPS for H.265) parameter sets so each random-access point is self-describing. encode waits for the submitted frame and returns its packet. flush waits for every outstanding encode job and drains the remainder — required before close when asynchronous submissions left frames in flight.
Source24 members
One timestamped video frame with retained storage and readiness semantics. The admitted packed-image path retains the backing Image, which in turn retains its crate::Matrix storage and exact producer readiness. Cloning a frame shares that retained value; it does not copy pixels or manufacture a second completion event.
7 members
Presentation timing for one decoded, captured, or generated frame. The presentation timestamp is a non-negative offset from a stream-defined epoch. Duration is absent when the producer cannot determine it.
Source9 members
One Vulkan-video-compatible image representation without Vulkan types.
Source5 members
10 members
Stateful streaming MP4 muxer for H.264/H.265 and optional PCM-S16 audio. Media payload is written as packets arrive. finalize appends the movie sample tables and closes the file. close deliberately abandons an unfinished file. Drop only releases the open file handle; it never manufactures a movie trailer or reports success.
Source10 members
One owned compressed video access unit in the selected track time base.
Source3 members
Border extents for pad: left, top, right, bottom in luma pixels.
Source25 members
Stateful local video player composed from VideoDemuxer and VideoDecoder. open decodes through the first display-order frame, so current_frame is immediately available on success. Timing controls do not create a second decoder or runtime owner; all hardware work remains inside the supplied Runtime-owned decoder session.
4 members
Observable counters for one player lifetime.
Source9 members
Stateful streaming MP4 recorder for hardware-encoded H.264/H.265 video. write_rgba submits one packed RGBA8 frame asynchronously and muxes every packet the slot ring has completed; finalize drains the remaining encoder jobs and closes the container. Audio chunks arriving before the first video frame are buffered until the first video presentation timestamp establishes the shared timeline.
Source6 members
Rational stream time base measured in seconds per timestamp tick.
SourceEnums
AV1 global-motion model for one reference of an inter frame.
Identity · Translation · RotZoom · Affine
AV1 interpolation-filter selection.
EightTap · EightTapSmooth · EightTapSharp · Bilinear · Switchable
AV1 open-bitstream-unit identity.
SequenceHeader · TemporalDelimiter · FrameHeader · TileGroup · Metadata · Frame · RedundantFrameHeader · TileList · Padding · Reserved(u8)
H.264 decoded-picture layout.
Progressive · InterlacedInterleavedLines · InterlacedSeparatePlanes
H.264 profile identity used for exact decoder capability queries.
Baseline · Main · High · High10 · High444Predictive
H.265 profile identity used for exact decoder capability queries.
Main · Main10 · MainStillPicture · FormatRangeExtensions · ScreenContentCodingExtensions
Matrix coefficients associated with a frame’s source color conversion. This is deliberately narrower than complete color management. Primaries, transfer function, chromatic adaptation, and mastering metadata are not inferred from this value.
Unspecified · Bt601 · Bt709 · Bt2020
Encoded or converted component range associated with a video frame.
Unspecified · Limited · Full
Codec-specific maximum level reported for a decode profile.
H264(u32) · H265(u32) · Av1(u32) · Vp9(u32)
Multi-plane YUV image layout admitted by the Video runtime.
Yuv420Planar8 · Nv12 · Yuv420Planar10 · P010 · P012
Rate-control policy requested for a future Vulkan Video encoder session.
ConstantQp · Cbr · Vbr
How a cropped source region maps to the requested output extent.
Stretch · Letterbox · CenterCrop
VP9 profile identity used for exact decoder capability queries.
Profile0 · Profile1 · Profile2 · Profile3
Functions
Count [true_positive, false_positive, false_negative, true_negative] for two equally-shaped U8 masks. Every nonzero byte is true. Errors Returns an error unless inputs are nonempty, equal-shaped U8 matrices on one runtime and their element count fits the shader ABI.
Compute every pairwise intersection-over-union for center-coordinate boxes. left and right must be nonempty FP32 matrices shaped [N, 4] and [M, 4]. Each row is [center_x, center_y, width, height]; negative widths and heights are clamped to zero, matching donor OA. A pair with no positive finite union produces zero. The returned matrix has shape [N, M]. The call records asynchronously and returns its output immediately. Reading the result is an explicit submission and observation point. Errors Returns an error when an input has the wrong rank, extent, dtype, or runtime, a shader-ABI size overflows, allocation fails, or runtime recording fails.
Calibrate a monocular camera from views >= 3 planar grids, matching calibrateCamera on Zhang’s method. object is [V, N, 3] object coordinates (the plane must satisfy z = 0) and image [V, N, 2] pixel observations with N >= 4. Intrinsics solve through the B-matrix constraints; extrinsics recover per-view; refine_iterations > 0 then runs damped bundle adjustment over (fx, fy, cx, cy, k1, k2) plus per-view pose. Returns camera, (k1, k2, p1, p2, k3) distortion, per-view rvecs [V, 3], tvecs [V, 3], and RMS reprojection error. Errors Returns an error for shape violations, degenerate grids, or a singular B-matrix solve.
Accumulate an integer classification confusion matrix. Rows are targets and columns are predictions. Either label being outside [0, class_count) ignores that element. Errors Returns an error unless inputs are equal nonempty I32 vectors on one runtime, class_count is positive, and all sizes fit the shader ABI.
Evaluate object-detection precision, recall, F1, AP, and mAP. Matching is class-aware, image-aware, greedy by descending score, and uses 101-point interpolated average precision. Classes without targets do not contribute to mAP. Scratch and outputs remain GPU-resident. Errors Returns an error when any shape, dtype, ownership, class-count, score-threshold, or 32-bit scratch-size contract is invalid.
Evaluate multiclass semantic-segmentation labels. Labels outside [0, class_count) are ignored. The operation records a confusion accumulator followed by a metrics kernel as one semantic Vision operation. Errors Returns an error unless inputs are equal-shaped nonempty I32 matrices on one runtime, class_count is positive, and all sizes fit the shader ABI.
Estimate the 3x3 essential matrix between points1 and points2 ([N, 2] F32, N >= 8) under the camera intrinsic matrix, matching findEssentialMat. Correspondences are normalized through K^-1, then the same normalized eight-point solve applies; the singular values of the result are collapsed to (s, s, 0) per the essential constraint. Errors Returns an error for mismatched/degenerate inputs, a singular camera, or nonpositive RANSAC bounds.
Estimate the 3x3 fundamental matrix between points1 and points2 ([N, 2] F32, N >= 8), matching findFundamentalMat. LeastSquares runs the normalized eight-point solve; Ransac draws max_iterations seeded 8-point minimal samples scored by symmetric epipolar distance under ransac_threshold (pixels) and refits on the inlier set. The estimate is enforced to rank 2 before return. Errors Returns an error for mismatched/degenerate inputs, nonpositive bounds, or when no rank-2 model exists.
Estimate the 3x3 homography mapping source [x, y] points to destination points. LeastSquares runs normalized DLT over all points; Ransac draws max_iterations seeded 4-point samples, keeps the largest consensus set under ransac_threshold symmetric transfer error (pixels), and refits on its inliers. Both inputs are [N, 2] F32 with N >= 4. Errors Returns an error for mismatched/degenerate inputs, a nonpositive threshold or iteration bound, or when no nonsingular model exists.
Select score-ranked boxes with deterministic class-aware suppression. Equal scores select the smaller source index. NaN or infinite scores are ignored. All outputs remain device-resident and the operation never sorts or compacts on the host. Errors Returns an error unless boxes are nonempty FP32 [N, 4], scores are FP32 [N], classes are I32 [N], all inputs share an runtime, thresholds are finite, iou_threshold is in [0, 1], and max_detections is positive.
Project object [x, y, z] points through rvec, tvec, camera, and distortion coefficients (k1, k2, p1, p2[, k3[, k4..]]), matching projectPoints with the radial+tangential model. object is [N, 3], distortion a [k]/[k, 1]/[1, k] vector (empty admitted), and the output is [N, 2] F32. Errors Returns an error for malformed inputs, a non-finite projection, or a zero/negative optical-center denominator.
Recover the relative camera pose (R, t) between views from an essential [3, 3] matrix, matching recoverPose. points1/points2 are the pixel correspondences and camera supplies intrinsics; all four (±t, R | R^W) candidates are triangulated and the cheirality-majority candidate wins, with the mask recording in-front points. Errors Returns an error for malformed inputs or when no candidate yields positive depth.
Convert between a [3, 1] Rodrigues rotation vector and a [3, 3] rotation matrix, matching Rodrigues in both directions. Errors Returns an error unless the input is a [3, 1]/[1, 3] or [3, 3] F32 matrix.
Solve camera pose from object [x, y, z] world points and image [u, v] projections under a camera [3, 3] intrinsic matrix. Runs a normalized DLT pose estimate refined by damped Gauss-Newton on the reprojection residuals, matching solvePnP SOLVEPNP_ITERATIVE. object is [N, 3] and image [N, 2] F32 with N >= 6. Errors Returns an error for degenerate inputs, a singular camera matrix, or failure to initialize a nonsingular pose.
Robust solve_pnp: draws iterations seeded 6-point samples, keeps the largest consensus set under reprojection_threshold (pixels), refits by damped Gauss-Newton over the inliers, and returns the inlier mask. SOLVEPNP_ITERATIVE-style scoring matches solvePnPRansac. Errors Returns an error for degenerate inputs, nonpositive bounds, or when no sample yields a nonsingular pose.
Triangulate points1/points2 correspondences under the projection1 / projection2 [3, 4] camera matrices, returning homogeneous [N, 4] points matching triangulatePoints. Errors Returns an error for malformed inputs or mismatched point counts.
Undistort [u, v] points by iterative inversion of the distortion model, matching undistortPoints. Without projection the result is normalized camera coordinates; with projection (and optional rectification) it is reprojected pixel coordinates. Errors Returns an error for malformed matrices or a singular camera/rectification.
Build the forward/undistort rectification coordinate map matching initUndistortRectifyMap for a widthxheight output, returned as the [1, 2, height, width] F32 map consumed by crate::image::remap. rectification is an optional [3, 3] rectifying rotation and projection an optional [3, 3] new camera matrix (defaulting to the input camera). Errors Returns an error for malformed matrices or nonpositive dimensions.
Types
0 members
calibrate_camera output: intrinsic matrix [3, 3], distortion coefficients [5, 1] ordered (k1, k2, p1, p2, k3), per-view rotation vectors [V, 3], per-view translations [V, 3], and scalar RMS reprojection error.
Source8 members
Stateful camera capture session over SDL’s camera backend. poll acquires the newest queued frame, uploads it into an owned RGBA8 texture, and returns it as a VideoFrame; the SDL surface is released immediately, so no ring-slot release contract exists on this route. The returned frame’s presentation timestamp is the camera’s hardware capture timestamp in microseconds and its duration follows the negotiated frame rate.
Source4 members
One GPU-consumable detection record, exactly 32 bytes. color_rgba is an optional per-instance display color in 0xRRGGBBAA; zero selects the overlay style fallback and preserves compatibility with older producers. track_id is a stable identity for trackers; rendering ignores it while postprocess and interaction code retain the same record layout across frames.
Source7 members
A fixed-capacity GPU-consumable detection buffer. Construction requires an Runtime; dropping the buffer never waits — the runtime’s retirement service keeps submitted resources alive through completion.
0 members
find_homography output: the 3x3 transform and the per-point inlier mask (1.0 inlier, 0.0 outlier; all ones under LeastSquares).
Source12 members
Discrete linear Kalman filter over fixed-size state, measurement, and control vectors. Construct with KalmanFilter::new, assign the model matrices with the set_* methods, seed KalmanFilter::set_state_post and KalmanFilter::set_error_cov_post, then alternate predict/correct calls.
Source0 members
solve_pnp output: rotation as a Rodrigues vector [3, 1] and the camera translation [3, 1].
Source0 members
recover_pose output: camera-2 relative rotation [3, 3], unit translation [3, 1], and the per-point cheirality mask.
Source7 members
Portal-approved screen or window capture producing owned RGBA8 frames. open may show the desktop picker. poll is nonblocking and never retains a PipeWire producer slot after returning. Drop releases host resources only; close explicitly disconnects the stream and reports a disconnect failure.
SourceEnums
Robust estimator selection shared by the correspondence ops. LeastSquares consumes every point through the direct linear solver. Ransac draws seeded minimal samples, keeps the largest consensus set under the reprojection threshold, then refits on its inliers.
LeastSquares · Ransac
Whether the capture targets whatever the compositor offers, an entire monitor, or an individual window.
MonitorOrWindow · Monitor · Window