Cropping Images
This API is used to crop an image.
- API calling
hilens.Preprocessor.crop(src, x, y, w, h, t)
- Parameter description
Table 1 Parameters Parameter
Mandatory
Type
Description
src
Yes
<class'numpy.ndarray'> object
Source image, which must be in the NV21 format. Width range: [64, 1920], a multiple of 2; Height range: [64, 1080], a multiple of 2.
x
Yes
Positive integer
X coordinate in the upper left corner of the cropped area. Value range: [0, 1920], a multiple of 2.
y
Yes
Positive integer
Y coordinate in the upper left corner of the cropped area. Value range: [0, 1080], a multiple of 2.
w
Yes
Positive integer
Width of the image after cropping. Value range: [64, 1920], a multiple of 2.
h
Yes
Positive integer
Height of the image after cropping. Value range: [64, 1080], a multiple of 2.
t
Yes
Integer 0 or 1
Format of the target image. The value 0 indicates NV21, and value 1 indicates NV12.
- Return value
If the crop operation is successful, the resized image is returned, which is a <class'numpy.ndarray'> object.
If the crop operation fails, "ValueError" is reported.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot