Open topic with navigation

# Add a Reference to a Database

To add a new reference for image comparison, follow these steps.

To add a reference to a database

- Add the reference using the action `TrainImageComparisonReference`, with the following parameters:

  `database` | The name of the database to add the reference to. The database must already exist.
  `identifier` | (Optional) A unique identifier for the reference (maximum 254 bytes). If you do not set this parameter, Media Server generates an identifier automatically.
  `imagedata` | (Set this or `imagepath`, but not both). The training image to add. The file must be uploaded as multipart/form-data. For more information about sending data to Media Server, see Send Data by Using a POST Method.
  `imagepath` | (Set this or `imagedata`, but not both). The path of the training image to add. The path must be absolute or relative to the Media Server executable file.
  `imagelabels` | (Optional) A label to identify the image that you are adding (maximum 254 bytes). If you do not set this parameter, Media Server generates a label automatically.
  `metadata` | (Optional) A comma-separated list of metadata key-value pairs to add to the reference. Separate keys from values using a colon (:). To include a comma or colon in a key name or value, you must enclose the key name or value in quotation marks (`"`) and escape any quotation marks that occur within the string with a backslash (`\`).

  For example:

      curl http://localhost:14000 -F action=TrainImageComparisonReference
                                  -F database=ReferenceImages
                                  -F imagedata=@camera39.png
                                  -F metadata=Location:Cambridge

  Alternatively, the following example provides the path of the training image rather than sending the image data:

      curl http://localhost:14000 -F action=TrainImageComparisonReference
                                  -F database=ReferenceImages
                                  -F imagepath=./training/comparison/camera39.png
                                  -F "metadata=Location:Cambridge"

  Media Server adds the reference to the database and returns the identifier.

© 2017 Hewlett Packard Enterprise Development LP | Send documentation feedback to HPE Close Send documentation feedback 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. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_HP_HTML5_bannerTitle.htm