Open topic with navigation

# analyze_image_in_file

The function `analyze_image_in_file` performs image analysis on a file. If there is a problem performing the analysis the function throws a Lua error.

## Arguments

Argument | Description
--- | ---
`filename` | (String) The file to perform analysis on.
`params` | (table) A table of additional parameters to configure the analysis. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. For information about how to use named parameters refer to the Connector Framework Server Administration Guide.

## Named Parameters

Named Parameter | Description | Configuration Parameter
--- | --- | ---
`poll_milliseconds` | (number) The amount of time that CFS waits before polling Image Server to see if an asynchronous request has completed, in milliseconds. The default interval is 5000 milliseconds. | ImageAnalysisPollMilliseconds
`request_parameters` | (table) Additional parameters to pass to the Image Server `analyze` action. |
`section` | (string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the `params` table are read from this section of the configuration file. |
`server` | (table) A table of additional parameters that configure communication with Image Server. The table maps parameter names (String) to parameter values. For information about the parameters that you can set, see the following table. |
`synchronous` | (Boolean) Specifies whether to send a synchronous request to Image Server (default false). You might want to make the request synchronous when you know that Image Server can process the request quickly (for example, in less than one second). | ImageAnalysisSynchronous
`taskSections` | (string) The types of analysis to perform as a comma-separated list. The names that you type must match the names of the analysis tasks that you have configured in your Image Server configuration file. | ImageAnalysisTaskSections
`transform` | (string) The filename of an XSL transform. This is applied to the response from Image Server. | ImageAnalysisTransform

## Image Server Settings

Named Parameter | Description | Configuration Parameter
--- | --- | ---
`section` | (string) The name of a section in the CFS configuration file. If you set this then any parameters not set in the `server` table are read from this section of the configuration file. If you do not set this parameter, the value of `section` from the `params` table is used. |
`host` | (string) The host name of the machine running Image Server. | ImageServerHost
`port` | (Number) The Image Server ACI port. | ImageServerPort
`retries` | (Number) The number of times to retry a request to Image Server if the first request fails. | ImageServerRetries
`timeout` | (Number) The maximum amount of time that CFS should wait for Image Server to respond, in seconds. | ImageServerTimeout
`sslSection` | (string) The name of a section in the CFS configuration file that contains settings for communicating with Image Server over SSL. | ImageServerSSLConfig
`readFromOriginalLocation` | (Boolean) By default, CFS sends files to Image Server over HTTP. If Image Server has direct access to the file, you can set this parameter to `true` and Image Server will read the file directly. If you set both `readFromOriginalLocation` and `sharedPath`, `readFromOriginalLocation` takes priority and `sharedPath` is ignored. | ReadFromOriginalLocation
`sharedPath` | (string) By default, CFS sends files to Image Server over HTTP. To transfer files to Image Server through a shared folder, set this parameter to the path of the folder. If you set both `readFromOriginalLocation` and `sharedPath`, `readFromOriginalLocation` takes priority and `sharedPath` is ignored. | ImageServerSharedPath

## Returns

(String). A string containing the result of the analysis. This is the XML response from Image Server, or the transformed response if an XSL transform was specified.

## Examples

The following example performs image analysis on `image.jpg` using the settings from the `ImageServerSettings` section of the CFS configuration file:

    local result = analyze_image_in_file("image.jpg",
       { section="ImageServerSettings" });

This example performs image analysis without reading any settings from the configuration file.

    local result = analyze_image_in_file("image.jpg",
       { transform = "transform.xsl",
         taskSections = "dococrtask,facerectask",
         server = { host="localhost", port="18005" } });

© 2016 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close We welcome your comments! To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a web mail client, and send this email to AutonomyTPFeedback@hpe.com. Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm