Skip to content

Commit 71749f9

Browse files
committed
split cpp install instructions
1 parent de34f54 commit 71749f9

File tree

3 files changed

+243
-20
lines changed

3 files changed

+243
-20
lines changed
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
---
2+
author: PatrickFarley
3+
ms.service: cognitive-services
4+
ms.topic: include
5+
ms.date: 08/01/2023
6+
ms.author: pafarley
7+
---
8+
9+
Installing the Vision SDK package will require your device to support the APT/Debian package manager.
10+
11+
### Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, Debian 10 (Buster)
12+
13+
1. **By installing the Azure AI Vision SDK package you acknowledge the [Azure AI Vision SDK license agreement](https://aka.ms/azai/vision/license)**.
14+
15+
1. The debian package is hosted on a Microsoft feed. To install the package, you first need to add the Microsoft feed to your device's package manager. To do that, run the following commands:
16+
17+
* For Ubuntu 18.04 (Bionic Beaver)
18+
```sh
19+
sudo apt install wget dpkg
20+
wget "https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb"
21+
sudo dpkg -i packages-microsoft-prod.deb
22+
```
23+
24+
* For Ubuntu 20.04 (Focal Fossa)
25+
```sh
26+
sudo apt install wget dpkg
27+
wget "https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb"
28+
sudo dpkg -i packages-microsoft-prod.deb
29+
```
30+
31+
* For Ubuntu 22.04 (Jammy Jellyfish)
32+
```sh
33+
sudo apt install wget dpkg
34+
wget "https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb"
35+
sudo dpkg -i packages-microsoft-prod.deb
36+
```
37+
38+
* For Debian 10 (Buster)
39+
```sh
40+
sudo apt install wget dpkg
41+
wget "https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb"
42+
sudo dpkg -i packages-microsoft-prod.deb
43+
```
44+
45+
1. Now install the Vision SDK Debian package required to build the sample:
46+
47+
```sh
48+
sudo apt update
49+
sudo apt install azure-ai-vision-dev-image-analysis
50+
```
51+
52+
1. Notice that the above package _azure-ai-vision-dev-image-analysis_ depends on additional Vision SDK packages, which will be installed automatically. Run `apt list azure-ai-vision*` to see the list of installed Vision SDK packages:
53+
* _azure-ai-vision-dev-common_
54+
* _azure-ai-vision-dev-image-analysis_
55+
* _azure-ai-vision-runtime-common_
56+
* _azure-ai-vision-runtime-common-media_
57+
* _azure-ai-vision-runtime-image-analysis_
58+
59+
### Other Linux platforms
60+
61+
1. **By installing the Azure AI Vision SDK package you acknowledge the [Azure AI Vision SDK license agreement](https://aka.ms/azai/vision/license)**.
62+
63+
1. Directly download the following 5 packages to your device:
64+
```sh
65+
wget https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod/pool/main/a/azure-ai-vision-dev-common/azure-ai-vision-dev-common-0.13.0~beta.1-Linux.deb
66+
wget https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod/pool/main/a/azure-ai-vision-dev-image-analysis/azure-ai-vision-dev-image-analysis-0.13.0~beta.1-Linux.deb
67+
wget https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod/pool/main/a/azure-ai-vision-runtime-common/azure-ai-vision-runtime-common-0.13.0~beta.1-Linux.deb
68+
wget https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod/pool/main/a/azure-ai-vision-runtime-common-media/azure-ai-vision-runtime-common-media-0.13.0~beta.1-Linux.deb
69+
wget https://packages.microsoft.com/repos/microsoft-ubuntu-bionic-prod/pool/main/a/azure-ai-vision-runtime-image-analysis/azure-ai-vision-runtime-image-analysis-0.13.0~beta.1-Linux.deb
70+
```
71+
1. Install the 5 packages:
72+
```sh
73+
sudo apt update
74+
sudo apt install ./azure-ai-vision-dev-common-0.13.0~beta.1-Linux.deb ./azure-ai-vision-dev-image-analysis-0.13.0~beta.1-Linux.deb ./azure-ai-vision-runtime-common-0.13.0~beta.1-Linux.deb ./azure-ai-vision-runtime-common-media-0.13.0~beta.1-Linux.deb ./azure-ai-vision-runtime-image-analysis-0.13.0~beta.1-Linux.deb
75+
```
76+
77+
### Verify installation
78+
79+
Verify installation succeeded by listing these folders:
80+
81+
```
82+
ls -la /usr/lib/azure-ai-vision
83+
ls -la /usr/include/azure-ai-vision
84+
ls -la /usr/share/doc/azure-ai-vision-*
85+
```
86+
87+
You should see shared object files named `libAzure-AI-Vision-*.so` and a few others in the first folder.
88+
89+
You should see header files named `vsion_api_cxx_*.hpp` and others in the second folder.
90+
91+
You should see package documents in the /usr/share/doc/azure-ai-vision-* folders (LICENSE.md, REDIST.txt, ThirdPartyNotices.txt).
92+
93+
## Compile the sample
94+
95+
* Download the content of this repository to your development PC. You can do that by either downloading and extracting this [ZIP file](https://github.com/Azure-Samples/azure-ai-vision-sdk/archive/master.zip), or cloning this repository using a Git client: `git clone https://github.com/Azure-Samples/azure-ai-vision-sdk.git`
96+
97+
* Navigate to the `linux` folder of this sample, where this `README.md` file is located
98+
99+
* Create a `build` folder under the `linux` folder, where the executable will be built, and navigate to that folder:
100+
101+
```sh
102+
mkdir build
103+
cd build
104+
```
105+
106+
* A Makefile is provided for direct compilation using the `make` command. Alternatively, a `CMakeLists.txt` is also provided if you prefer to compile the sample using the `cmake` command:
107+
108+
* To compile using make, run
109+
* `make -f ../makefile`
110+
* To compile using CMake:
111+
* Install `cmake` (run `sudo apt install cmake`).
112+
* Create a makefile by running: `cmake ..`
113+
* Then compile by running: `make`
114+
115+
You should see the resulting executable `image-analysis-samples.exe` in the current folder.
116+
117+
## Get usage help
118+
119+
To get usage help run the executable with the `-h` or `--help` flag:
120+
121+
```sh
122+
./image-analysis-samples.exe -h
123+
```
124+
125+
You will see the following output:
126+
127+
```
128+
Azure AI Vision SDK - Image Analysis Samples
129+
130+
To run the samples:
131+
132+
image-analysis-samples.exe [--key|-k <your-key>] [--endpoint|-e <your-endpoint>]
133+
134+
Where:
135+
<your-key> - A computer vision key you get from your Azure portal.
136+
It should be a 32-character HEX number.
137+
<your-endpoint> - A computer vision endpoint you get from your Azure portal.
138+
It should have the form: https://<your-computer-vision-resource-name>.cognitiveservices.azure.com
139+
140+
As an alternative to specifying the above command line arguments, you can specify
141+
these environment variables: VISION_KEY and VISION_ENDPOINT
142+
143+
To get this usage help, run:
144+
145+
image-analysis-samples.exe --help|-h
146+
```
147+
148+
## Run the sample
149+
150+
* Open a terminal windows where the executable `image-analysis-samples.exe` is located.
151+
152+
* Copy the image file `sample.jpg` to the current folder, such that it resides in the same folder as the executable `image-analysis-samples.exe`:
153+
```
154+
cp ../../sample.jpg .
155+
```
156+
157+
* Run the sample in one of two ways:
158+
* By specifying the vision key & endpoint as run-time arguments:
159+
```
160+
./image-analysis-samples.exe -k <your-key> -e <your-endpoint>
161+
```
162+
* By first defining the appropriate environment variables, then running the executable without arguments:
163+
```
164+
export VISION_KEY=<your-key>
165+
export VISION_ENDPOINT=<your-endpoint>
166+
167+
./image-analysis-samples.exe
168+
```
169+
170+
* You should see a menu of samples to run. Enter the number corresponding to the sample you want to run, and press `Enter`. If this is your first time, start with sample 1, as it does analysis of all the visual features. The sample will run and display the results in the console window. The menu will be displayed again, so you can run another sample. Select `0` to exit the program.
171+
172+
## Troubleshooting
173+
174+
An error message will be displayed if the sample fails to run. Here are some common errors and how to fix them:
175+
176+
* `error while loading shared libraries: libAzure-AI-Vision-Extension-Image.so: cannot open shared object file: No such file or directory`
177+
* To fix this, run `export LD_LIBRARY_PATH=/usr/lib/azure-ai-vision/:$LD_LIBRARY_PATH` and re-run `./image-analysis-samples.exe`
178+
179+
* `Failed with error: HTTPAPI_OPEN_REQUEST_FAILED`.
180+
* Your endpoint may be incorrect. Make sure you correctly copied the endpoint from your Azure portal. It should be in the form `https://<your-computer-vision-resource-name>.cognitiveservices.azure.com`
181+
182+
* `Exception with an error code: 0x73 (AZAC_ERR_FAILED_TO_OPEN_INPUT_FILE_FOR_READING) `
183+
* The image file cannot be found. Make sure you copy the image file to the folder where the executable is located, and re-run.
184+
185+
* `InvalidRequest: The feature 'Caption' is not supported in this region`
186+
* Your endpoint is from an Azure region that does not support the `Caption` and `DenseCaptions` features. You can either change the endpoint to a supported region, or remove the `Caption` and `DenseCaptions` features from the list of features to analyze.
187+
188+
* `Unknown error in sending http request`
189+
* If you are running on Ubuntu 22.04 LTS, see comment above about the need to install **libssl1.1**.
190+
191+
## Cleanup
192+
193+
The Vision SDK Debian packages can be removed by running this single command:
194+
195+
```
196+
sudo apt-get purge azure-ai-vision-*
197+
```
198+
199+
## Required libraries for run-time distribution
200+
201+
The folder `/usr/lib/azure-ai-vision` contains several shared object libraries (`.so` files), needed to support different sets of Vision SDK APIs. For Image Analysis, only the following subset is needed when you distribute a run-time package of your application:
202+
203+
```
204+
libAzure-AI-Vision-Native.so
205+
libAzure-AI-Vision-Extension-Image.so
206+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
author: PatrickFarley
3+
ms.service: cognitive-services
4+
ms.topic: include
5+
ms.date: 08/01/2023
6+
ms.author: pafarley
7+
---
8+
9+
10+
The Vision SDK for C++ is available as a NuGet package. For more information, see <a href="https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis" target="_blank">Azure.AI.Vision.ImageAnalysis</a>.
11+
12+
# [Terminal](#tab/dotnetcli)
13+
14+
The Vision SDK for C# can be installed from the [.NET CLI](https://dotnet.microsoft.com/download/dotnet/). To add a package reference in your project file, run this command in the folder where your .csproj` file is located:
15+
16+
```dotnetcli
17+
dotnet add package Azure.AI.Vision.ImageAnalysis --prerelease
18+
```
19+
20+
# [PowerShell](#tab/powershell)
21+
22+
The Vision SDK for C# can be installed from the [.NET CLI](https://dotnet.microsoft.com/download/dotnet/). To add a package reference in your project file, run this command in the folder where your .csproj` file is located:
23+
24+
```powershell
25+
Install-Package Azure.AI.Vision.ImageAnalysis --prerelease
26+
```
27+
28+
# [Visual Studio](#tab/vs)
29+
30+
Open Visual Studio and create a new application project. Then install the client SDK by right-clicking on the project solution in the **Solution Explorer** and selecting **Manage NuGet Packages**. In the package manager that opens select **Browse**, check **Include prerelease**, and search for `Azure.AI.Vision.ImageAnalysis`. Select **Install**.
31+
32+
---
33+

articles/ai-services/computer-vision/includes/setup-sdk/cpp.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,12 @@ This guide shows how to install the Vision SDK for C++.
1616

1717
## Install the Vision SDK for C++
1818

19-
The Vision SDK for C++ is available as a NuGet package. For more information, see <a href="https://www.nuget.org/packages/Azure.AI.Vision.ImageAnalysis" target="_blank">Azure.AI.Vision.ImageAnalysis</a>.
19+
# [Windows](#tab/windows)
2020

21-
# [Terminal](#tab/dotnetcli)
21+
[!INCLUDE [Requirements](cpp-windows.md)]
2222

23-
The Vision SDK for C# can be installed from the [.NET CLI](https://dotnet.microsoft.com/download/dotnet/). To add a package reference in your project file, run this command in the folder where your .csproj` file is located:
24-
25-
```dotnetcli
26-
dotnet add package Azure.AI.Vision.ImageAnalysis --prerelease
27-
```
28-
29-
# [PowerShell](#tab/powershell)
30-
31-
The Vision SDK for C# can be installed from the [.NET CLI](https://dotnet.microsoft.com/download/dotnet/). To add a package reference in your project file, run this command in the folder where your .csproj` file is located:
32-
33-
```powershell
34-
Install-Package Azure.AI.Vision.ImageAnalysis --prerelease
35-
```
36-
37-
# [Visual Studio](#tab/vs)
38-
39-
Open Visual Studio and create a new application project. Then install the client SDK by right-clicking on the project solution in the **Solution Explorer** and selecting **Manage NuGet Packages**. In the package manager that opens select **Browse**, check **Include prerelease**, and search for `Azure.AI.Vision.ImageAnalysis`. Select **Install**.
23+
# [Linux](#tab/linux)
4024

25+
[!INCLUDE [Requirements](cpp-linux.md)]
4126

4227
---
43-

0 commit comments

Comments
 (0)