Extract text from an image
Extract the desired text from the image with precision with the help of Extract text.
The extract text option allows users to:
- Detect text only: This option returns only the image's position.
detect_only
is an alias of this parameter. - Detect and get the text (default): This option returns both the position and the text at the respective location.
note
Instead of getting the output in a traditional CDN URL, you will get a JSON output from the Context API while the CDN URL will return the original image without any modifications.
Output:
The result of the Extract text
is a JSON value with multiple keys and values, such as:
{
"data": [
{
"bbox": {
"top": 212,
"left": 225,
"width": 1301,
"height": 144
},
"text": "A NEGATIVE MIND",
"confidence": 0.92
},
...
],
"text": "A NEGATIVE MIND WILL NEVER ....
}
Property | Description |
---|---|
data | Consists of multiple text positions and their associated text. |
bbox | The text's position (top, left) and dimensions (height, width). |
text | The actual text at the given position (bbox ). |
confidence | the output's accuracy (out of 1) |
- Input Image
- Context API Response
- URL
- React
<PixelBinImage url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detection.jpeg" />
{
"data": [
{
"bbox": {
"top": 212,
"left": 225,
"width": 1301,
"height": 144
},
"text": "A NEGATIVE MIND",
"confidence": 0.92
},
{
"bbox": {
"top": 366,
"left": 229,
"width": 1289,
"height": 124
},
"text": "WILL NEVER GIVE YOU",
"confidence": 0.794
},
{
"bbox": {
"top": 507,
"left": 224,
"width": 92,
"height": 121
},
"text": "A",
"confidence": 0.999
},
{
"bbox": {
"top": 485,
"left": 365,
"width": 1138,
"height": 160
},
"text": "POSITIVE LIFE_",
"confidence": 0.723
}
],
"text": "A NEGATIVE MIND WILL NEVER GIVE YOU A POSITIVE LIFE_"
}