“da3174634e1c928d48aaf48448ed8a70f17d2cf7”上不存在“doc/git@gitcode.net:s920243400/PaddleDetection.git”
提交 503d09eb 编写于 作者: G Gloria

Update docs against 11958+12066+12127+12142+12155

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 5fc39b85
# Image Processing # @ohos.multimedia.image (Image Processing)
The **Image** module provides APIs for image processing. You can use the APIs to create a **PixelMap** object with specified properties or read image pixel data (even in an area). The **Image** module provides APIs for image processing. You can use the APIs to create a **PixelMap** object with specified properties or read image pixel data (even in an area).
...@@ -1077,9 +1077,9 @@ const data = new ArrayBuffer(112); ...@@ -1077,9 +1077,9 @@ const data = new ArrayBuffer(112);
const imageSourceApi = image.createImageSource(data); const imageSourceApi = image.createImageSource(data);
``` ```
## image.createIncrementalSource<sup>9+</sup> ## image.CreateIncrementalSource<sup>9+</sup>
createIncrementalSource(buf: ArrayBuffer): ImageSource CreateIncrementalSource(buf: ArrayBuffer): ImageSource
Creates an **ImageSource** instance in incremental mode based on the buffers. Creates an **ImageSource** instance in incremental mode based on the buffers.
...@@ -1101,12 +1101,12 @@ Creates an **ImageSource** instance in incremental mode based on the buffers. ...@@ -1101,12 +1101,12 @@ Creates an **ImageSource** instance in incremental mode based on the buffers.
```js ```js
const buf = new ArrayBuffer(96); // 96 is the size of the pixel map buffer to create. The value is calculated as follows: height x width x 4. const buf = new ArrayBuffer(96); // 96 is the size of the pixel map buffer to create. The value is calculated as follows: height x width x 4.
const imageSourceIncrementalSApi = image.createIncrementalSource(buf); const imageSourceIncrementalSApi = image.CreateIncrementalSource(buf);
``` ```
## image.createIncrementalSource<sup>9+</sup> ## image.CreateIncrementalSource<sup>9+</sup>
createIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource
Creates an **ImageSource** instance in incremental mode based on the buffers. Creates an **ImageSource** instance in incremental mode based on the buffers.
...@@ -1129,7 +1129,7 @@ Creates an **ImageSource** instance in incremental mode based on the buffers. ...@@ -1129,7 +1129,7 @@ Creates an **ImageSource** instance in incremental mode based on the buffers.
```js ```js
const buf = new ArrayBuffer(96); // 96 is the size of the pixel map buffer to create. The value is calculated as follows: height x width x 4. const buf = new ArrayBuffer(96); // 96 is the size of the pixel map buffer to create. The value is calculated as follows: height x width x 4.
const imageSourceIncrementalSApi = image.createIncrementalSource(buf); const imageSourceIncrementalSApi = image.CreateIncrementalSource(buf);
``` ```
## ImageSource ## ImageSource
...@@ -1203,7 +1203,7 @@ Obtains information about an image with the specified index. This API uses a pro ...@@ -1203,7 +1203,7 @@ Obtains information about an image with the specified index. This API uses a pro
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ----- | ------ | ---- | ------------------------------------- | | ----- | ------ | ---- | ------------------------------------- |
| index | number | No | Index of the image. If this parameter is not set, the default value **0** is used.| | index | number | No | Index of the image. If this parameter is not set, the default value **0** is used.|
...@@ -1376,8 +1376,8 @@ Updates incremental data. This API uses a promise to return the result. ...@@ -1376,8 +1376,8 @@ Updates incremental data. This API uses a promise to return the result.
| ---------- | ----------- | ---- | ------------ | | ---------- | ----------- | ---- | ------------ |
| buf | ArrayBuffer | Yes | Incremental data. | | buf | ArrayBuffer | Yes | Incremental data. |
| isFinished | boolean | Yes | Whether the update is complete.| | isFinished | boolean | Yes | Whether the update is complete.|
| value | number | No | Offset for data reading. | | value | number | Yes | Offset for data reading. |
| length | number | No | Array length. | | length | number | Yes | Array length. |
**Return value** **Return value**
...@@ -1409,8 +1409,8 @@ Updates incremental data. This API uses an asynchronous callback to return the r ...@@ -1409,8 +1409,8 @@ Updates incremental data. This API uses an asynchronous callback to return the r
| ---------- | ------------------- | ---- | -------------------- | | ---------- | ------------------- | ---- | -------------------- |
| buf | ArrayBuffer | Yes | Incremental data. | | buf | ArrayBuffer | Yes | Incremental data. |
| isFinished | boolean | Yes | Whether the update is complete. | | isFinished | boolean | Yes | Whether the update is complete. |
| value | number | No | Offset for data reading. | | value | number | Yes | Offset for data reading. |
| length | number | No | Array length. | | length | number | Yes | Array length. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -1772,7 +1772,7 @@ Creates an **ImageReceiver** instance by specifying the image width, height, for ...@@ -1772,7 +1772,7 @@ Creates an **ImageReceiver** instance by specifying the image width, height, for
| -------- | ------ | ---- | ---------------------- | | -------- | ------ | ---- | ---------------------- |
| width | number | Yes | Default image width. | | width | number | Yes | Default image width. |
| height | number | Yes | Default image height. | | height | number | Yes | Default image height. |
| format | number | Yes | Image format, which is a constant of [ImageFormat](#imageformat9). (Currently, the value of this parameter is agreed between the user and camera. In the future, there may be other application scenarios. The receiver is used only for transfer. Currently, only **ImageFormat:JPEG** is supported.) | | format | number | Yes | Image format, which is a constant of [ImageFormat](#imageformat9). (Only ImageFormat:JPEG and 4 are supported.) |
| capacity | number | Yes | Maximum number of images that can be accessed at the same time.| | capacity | number | Yes | Maximum number of images that can be accessed at the same time.|
**Return value** **Return value**
...@@ -2080,9 +2080,9 @@ Obtains an image buffer from the idle queue and writes image data into it. This ...@@ -2080,9 +2080,9 @@ Obtains an image buffer from the idle queue and writes image data into it. This
```js ```js
creator.dequeueImage((err, img) => { creator.dequeueImage((err, img) => {
if (err) { if (err) {
console.info('dequeueImage succeeded.');
}
console.info('dequeueImage failed.'); console.info('dequeueImage failed.');
}
console.info('dequeueImage succeeded.');
}); });
``` ```
...@@ -2128,12 +2128,25 @@ Places the drawn image in the dirty queue. This API uses an asynchronous callbac ...@@ -2128,12 +2128,25 @@ Places the drawn image in the dirty queue. This API uses an asynchronous callbac
**Example** **Example**
```js ```js
creator.queueImage(img, (err) => { creator.dequeueImage().then(img => {
// Draw the image.
img.getComponent(4).then(component => {
var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
bufferArr[i + 1] = 0; //G
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
})
creator.queueImage(img, (err) => {
if (err) { if (err) {
console.info('dequeueImage failed: ' + err); console.info('queueImage failed: ' + err);
} }
console.info('dequeueImage succeeded'); console.info('queueImage succeeded');
})
}) })
``` ```
### queueImage<sup>9+</sup> ### queueImage<sup>9+</sup>
...@@ -2159,11 +2172,24 @@ Places the drawn image in the dirty queue. This API uses a promise to return the ...@@ -2159,11 +2172,24 @@ Places the drawn image in the dirty queue. This API uses a promise to return the
**Example** **Example**
```js ```js
creator.queueImage(img).then(() => { creator.dequeueImage().then(img => {
console.info('dequeueImage succeeded.'); // Draw the image.
}).catch(error => { img.getComponent(4).then(component => {
console.info('dequeueImage failed: ' + error); var bufferArr = new Uint8Array(component.byteBuffer);
for (var i = 0; i < bufferArr.length; i += 4) {
bufferArr[i] = 0; //B
bufferArr[i + 1] = 0; //G
bufferArr[i + 2] = 255; //R
bufferArr[i + 3] = 255; //A
}
})
creator.queueImage(img).then(() => {
console.info('queueImage succeeded.');
}).catch(error => {
console.info('queueImage failed: ' + error);
})
}) })
``` ```
### on<sup>9+</sup> ### on<sup>9+</sup>
...@@ -2398,7 +2424,7 @@ Enumerates the pixel formats of images. ...@@ -2398,7 +2424,7 @@ Enumerates the pixel formats of images.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
| Name | Default Value| Description | | Name | Value | Description |
| ---------------------- | ------ | ----------------- | | ---------------------- | ------ | ----------------- |
| UNKNOWN | 0 | Unknown format. | | UNKNOWN | 0 | Unknown format. |
| RGB_565 | 2 | RGB_565. | | RGB_565 | 2 | RGB_565. |
...@@ -2416,7 +2442,7 @@ Enumerates the alpha types of images. ...@@ -2416,7 +2442,7 @@ Enumerates the alpha types of images.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
| Name | Default Value| Description | | Name | Value | Description |
| -------- | ------ | ----------------------- | | -------- | ------ | ----------------------- |
| UNKNOWN | 0 | Unknown alpha type. | | UNKNOWN | 0 | Unknown alpha type. |
| OPAQUE | 1 | There is no alpha or the image is opaque.| | OPAQUE | 1 | There is no alpha or the image is opaque.|
...@@ -2429,7 +2455,7 @@ Enumerates the scale modes of images. ...@@ -2429,7 +2455,7 @@ Enumerates the scale modes of images.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
| Name | Default Value| Description | | Name | Value | Description |
| --------------- | ------ | -------------------------------------------------- | | --------------- | ------ | -------------------------------------------------- |
| CENTER_CROP | 1 | Scales the image so that it fills the requested bounds of the target and crops the extra.| | CENTER_CROP | 1 | Scales the image so that it fills the requested bounds of the target and crops the extra.|
| FIT_TARGET_SIZE | 0 | Reduces the image size to the dimensions of the target. | | FIT_TARGET_SIZE | 0 | Reduces the image size to the dimensions of the target. |
...@@ -2519,7 +2545,7 @@ Describes the exchangeable image file format (EXIF) information of an image. ...@@ -2519,7 +2545,7 @@ Describes the exchangeable image file format (EXIF) information of an image.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
| Name | Default Value | Description | | Name | Value | Description |
| ----------------- | ----------------------- | ------------------------ | | ----------------- | ----------------------- | ------------------------ |
| BITS_PER_SAMPLE | "BitsPerSample" | Number of bits per pixel. | | BITS_PER_SAMPLE | "BitsPerSample" | Number of bits per pixel. |
| ORIENTATION | "Orientation" | Image orientation. | | ORIENTATION | "Orientation" | Image orientation. |
...@@ -2542,7 +2568,7 @@ Enumerates the image formats. ...@@ -2542,7 +2568,7 @@ Enumerates the image formats.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
| Name | Default Value| Description | | Name | Value | Description |
| ------------ | ------ | -------------------- | | ------------ | ------ | -------------------- |
| YCBCR_422_SP | 1000 | YCBCR422 semi-planar format.| | YCBCR_422_SP | 1000 | YCBCR422 semi-planar format.|
| JPEG | 2000 | JPEG encoding format. | | JPEG | 2000 | JPEG encoding format. |
...@@ -2553,7 +2579,7 @@ Enumerates the color component types of images. ...@@ -2553,7 +2579,7 @@ Enumerates the color component types of images.
**System capability**: SystemCapability.Multimedia.Image.ImageReceiver **System capability**: SystemCapability.Multimedia.Image.ImageReceiver
| Name | Default Value| Description | | Name | Value | Description |
| ----- | ------ | ----------- | | ----- | ------ | ----------- |
| YUV_Y | 1 | Luminance component. | | YUV_Y | 1 | Luminance component. |
| YUV_U | 2 | Chrominance component. | | YUV_U | 2 | Chrominance component. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册