File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def to_bgr888(
3333 height: Height of the image in pixels
3434 bytesperline: Bytes per line, either a single int (0 for no padding) or a
3535 sequence of ints with one value per plane for multiplane formats
36- arr: Numpy array containing the pixel data
36+ arr: Numpy uint8 array containing the pixel data
3737 options: Optional dictionary with conversion options:
3838 - backends: List of backends in priority order, e.g. ['opencv', 'numba']
3939 - range: 'limited' or 'full' (for YUV formats)
@@ -44,6 +44,10 @@ def to_bgr888(
4444 Numpy array containing the image in BGR888 format
4545 """
4646
47+ if arr .dtype != np .uint8 :
48+ raise ValueError (f'Input array must have dtype uint8, got { arr .dtype } ' )
49+ arr = np .ascontiguousarray (arr ).reshape (- 1 )
50+
4751 # Normalize bytesperline to a per-plane tuple of concrete (non-zero) strides
4852 if isinstance (bytesperline , int ):
4953 if len (fmt .planes ) > 1 and bytesperline != 0 :
You can’t perform that action at this time.
0 commit comments