# Source: https://docs.aimlapi.com/api-references/vision-models/ofr-optical-feature-recognition.md

# OFR: Optical Feature Recognition

Our API provides a feature to extract visual features from images.

## Identify visual features in images.

> Performs optical feature recognition (OFR) to identify visual features such as objects, landmarks, or logos from images, aiding in image analysis and categorization.

```json
{"openapi":"3.0.0","info":{"title":"AI/ML Gateway","version":"1.0"},"servers":[{"url":"https://api.aimlapi.com"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{"access-token":{"scheme":"bearer","bearerFormat":"<YOUR_AIMLAPI_KEY>","type":"http","description":"Bearer key"}},"schemas":{"Vision.v1.VisionRequestDTO":{"type":"object","properties":{"image":{"type":"object","properties":{"source":{"type":"object","properties":{"imageUri":{"type":"string","description":"The URI of the source image."}},"required":["imageUri"],"additionalProperties":false}},"required":["source"],"additionalProperties":false,"description":"The image to be processed."},"features":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["FACE_DETECTION","LANDMARK_DETECTION","LOGO_DETECTION","LABEL_DETECTION","TEXT_DETECTION","DOCUMENT_TEXT_DETECTION","SAFE_SEARCH_DETECTION","IMAGE_PROPERTIES","CROP_HINTS","WEB_DETECTION","PRODUCT_SEARCH","OBJECT_LOCALIZATION"],"description":"The feature type."},"maxResults":{"type":"number","description":"Maximum number of results of this type."},"model":{"type":"string","enum":["builtin/stable","builtin/latest"],"description":"Model to use for the feature."}},"required":["type"],"additionalProperties":false},"description":"Requested features."},"imageContext":{"type":"object","properties":{"latLongRect":{"type":"object","properties":{"minLatLng":{"type":"object","properties":{"latitude":{"type":"number","description":"The latitude in degrees. It must be in the range [-90.0, +90.0]."},"longitude":{"type":"number","description":"The longitude in degrees. It must be in the range [-180.0, +180.0]."}},"required":["latitude","longitude"],"additionalProperties":false,"description":"Min latitude-longitude pair."},"maxLatLng":{"type":"object","properties":{"latitude":{"type":"number","description":"The latitude in degrees. It must be in the range [-90.0, +90.0]."},"longitude":{"type":"number","description":"The longitude in degrees. It must be in the range [-180.0, +180.0]."}},"required":["latitude","longitude"],"additionalProperties":false,"description":"Max latitude-longitude pair."}},"required":["minLatLng","maxLatLng"],"additionalProperties":false,"description":"Rectangle determined by min and max LatLng (latitude-longitude) pairs."},"languageHints":{"type":"array","items":{"type":"string"},"description":"List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting languageHints is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong)."},"cropHintsParams":{"type":"object","properties":{"aspectRatios":{"type":"array","items":{"type":"number"},"description":"Aspect ratios in floats, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored."}},"required":["aspectRatios"],"additionalProperties":false,"description":"Parameters for crop hints annotation request."},"faceRecognitionParams":{"type":"object","properties":{"celebritySet":{"type":"array","items":{"type":"string"}}},"required":["celebritySet"],"additionalProperties":false,"description":"Parameters for face recognition"},"textDetectionParams":{"type":"object","properties":{"enableTextDetectionConfidenceScore":{"type":"boolean","description":"By default, Cloud Vision API only includes confidence score for DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence score for TEXT_DETECTION as well."}},"required":["enableTextDetectionConfidenceScore"],"additionalProperties":false,"description":"Parameters for text detection and document text detection."}},"additionalProperties":false,"description":"Additional context that may accompany the image."}},"required":["image","features"]},"Vision.v1.OCRResponseDTO":{"type":"object","properties":{"pages":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"The page index in a PDF document starting from 0"},"markdown":{"type":"string","description":"The markdown string response of the page"},"images":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","description":"Image ID for extracted image in a page"},"top_left_x":{"type":"integer","nullable":true,"description":"X coordinate of top-left corner of the extracted image"},"top_left_y":{"type":"integer","nullable":true,"description":"Y coordinate of top-left corner of the extracted image"},"bottom_right_x":{"type":"integer","nullable":true,"description":"X coordinate of bottom-right corner of the extracted image"},"bottom_right_y":{"type":"integer","nullable":true,"description":"Y coordinate of bottom-right corner of the extracted image"},"image_base64":{"type":"string","nullable":true,"format":"uri","description":"Base64 string of the extracted image"}},"required":["id","top_left_x","top_left_y","bottom_right_x","bottom_right_y"]},"description":"List of all extracted images in the page"},"dimensions":{"type":"object","nullable":true,"properties":{"dpi":{"type":"integer","description":"Dots per inch of the page-image."},"height":{"type":"integer","description":"Height of the image in pixels."},"width":{"type":"integer","description":"Width of the image in pixels."}},"required":["dpi","height","width"],"description":"The dimensions of the PDF page's screenshot image"}},"required":["index","markdown","images","dimensions"]},"description":"List of OCR info for pages"},"model":{"type":"string","enum":["mistral-ocr-latest"],"description":"The model used to generate the OCR."},"usage_info":{"type":"object","properties":{"pages_processed":{"type":"integer","description":"Number of pages processed"},"doc_size_bytes":{"type":"integer","nullable":true,"description":"Document size in bytes"}},"required":["pages_processed","doc_size_bytes"],"description":"Usage info for the OCR request."}},"required":["pages","model","usage_info"]}}},"paths":{"/vision":{"post":{"operationId":"DocumentModelsController_processVisionRequest","summary":"Identify visual features in images.","description":"Performs optical feature recognition (OFR) to identify visual features such as objects, landmarks, or logos from images, aiding in image analysis and categorization.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vision.v1.VisionRequestDTO"}}}},"responses":{"201":{"description":"Successfully processed document with vision model","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Vision.v1.OCRResponseDTO"}}}}},"tags":["Vision Models"]}}}}
```