No public description
PiperOrigin-RevId: 578266141
This commit is contained in:
parent
b9ff9708e3
commit
35f2f98a1c
|
@ -81,6 +81,8 @@ void ImageFrameSubmodule(pybind11::module* module) {
|
||||||
become immutable after creation.
|
become immutable after creation.
|
||||||
|
|
||||||
Creation examples:
|
Creation examples:
|
||||||
|
|
||||||
|
```python
|
||||||
import cv2
|
import cv2
|
||||||
cv_mat = cv2.imread(input_file)[:, :, ::-1]
|
cv_mat = cv2.imread(input_file)[:, :, ::-1]
|
||||||
rgb_frame = mp.ImageFrame(image_format=ImageFormat.SRGB, data=cv_mat)
|
rgb_frame = mp.ImageFrame(image_format=ImageFormat.SRGB, data=cv_mat)
|
||||||
|
@ -92,6 +94,7 @@ void ImageFrameSubmodule(pybind11::module* module) {
|
||||||
pil_img = Image.new('RGB', (60, 30), color = 'red')
|
pil_img = Image.new('RGB', (60, 30), color = 'red')
|
||||||
image_frame = mp.ImageFrame(
|
image_frame = mp.ImageFrame(
|
||||||
image_format=mp.ImageFormat.SRGB, data=np.asarray(pil_img))
|
image_format=mp.ImageFormat.SRGB, data=np.asarray(pil_img))
|
||||||
|
```
|
||||||
|
|
||||||
The pixel data in an ImageFrame can be retrieved as a numpy ndarray by calling
|
The pixel data in an ImageFrame can be retrieved as a numpy ndarray by calling
|
||||||
`ImageFrame.numpy_view()`. The returned numpy ndarray is a reference to the
|
`ImageFrame.numpy_view()`. The returned numpy ndarray is a reference to the
|
||||||
|
|
Loading…
Reference in New Issue
Block a user