Skip to content

Commit cb5bd26

Browse files
authored
DOCS-3548: Add vision service samples (#503)
1 parent 87e928d commit cb5bd26

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

Diff for: src/services/vision/vision.ts

+77
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ export interface Vision extends Resource {
1515
/**
1616
* Get a list of detections in the next image given a camera.
1717
*
18+
* @example
19+
*
20+
* ```ts
21+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
22+
* const detections = await vision.getDetectionsFromCamera('my_camera');
23+
* ```
24+
*
1825
* @param cameraName - The name of the camera to use for detection.
1926
* @returns - The list of Detections.
2027
*/
@@ -26,6 +33,22 @@ export interface Vision extends Resource {
2633
/**
2734
* Get a list of detections in the given image.
2835
*
36+
* @example
37+
*
38+
* ```ts
39+
* const camera = new VIAM.CameraClient(machine, 'my_camera');
40+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
41+
*
42+
* const mimeType = 'image/jpeg';
43+
* const image = await camera.getImage(mimeType);
44+
* const detections = await vision.getDetections(
45+
* image,
46+
* 600,
47+
* 600,
48+
* mimeType
49+
* );
50+
* ```
51+
*
2952
* @param image - The image from which to get detections.
3053
* @param width - The width of the image.
3154
* @param height - The height of the image.
@@ -43,6 +66,16 @@ export interface Vision extends Resource {
4366
/**
4467
* Get a list of classifications in the next image given a camera.
4568
*
69+
* @example
70+
*
71+
* ```ts
72+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
73+
* const classifications = await vision.getClassificationsFromCamera(
74+
* 'my_camera',
75+
* 10
76+
* );
77+
* ```
78+
*
4679
* @param cameraName - The name of the camera to use for classification.
4780
* @param count - The number of Classifications requested.
4881
* @returns - The list of Classifications.
@@ -56,6 +89,23 @@ export interface Vision extends Resource {
5689
/**
5790
* Get a list of classifications in the given image.
5891
*
92+
* @example
93+
*
94+
* ```ts
95+
* const camera = new VIAM.CameraClient(machine, 'my_camera');
96+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
97+
*
98+
* const mimeType = 'image/jpeg';
99+
* const image = await camera.getImage(mimeType);
100+
* const classifications = await vision.getClassifications(
101+
* image,
102+
* 600,
103+
* 600,
104+
* mimeType,
105+
* 10
106+
* );
107+
* ```
108+
*
59109
* @param image - The image from which to get classifications.
60110
* @param width - The width of the image.
61111
* @param height - The height of the image.
@@ -76,6 +126,14 @@ export interface Vision extends Resource {
76126
* Returns a list of the 3D point cloud objects and associated metadata in the
77127
* latest picture obtained from the specified 3D camera.
78128
*
129+
* @example
130+
*
131+
* ```ts
132+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
133+
* const pointCloudObjects =
134+
* await vision.getObjectPointClouds('my_camera');
135+
* ```
136+
*
79137
* @param cameraName - The name of the camera.
80138
* @returns - The list of PointCloudObjects
81139
*/
@@ -89,6 +147,13 @@ export interface Vision extends Resource {
89147
* booleans indicating whether classifications, detections, and 3d
90148
* segmentation are supported.
91149
*
150+
* @example
151+
*
152+
* ```ts
153+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
154+
* const properties = await vision.getProperties();
155+
* ```
156+
*
92157
* @returns - The properties of the vision service
93158
*/
94159
getProperties: (extra?: Struct) => Promise<Properties>;
@@ -97,6 +162,18 @@ export interface Vision extends Resource {
97162
* Returns the requested image, classifications, detections, and 3d point
98163
* cloud objects in the next image given a camera.
99164
*
165+
* @example
166+
*
167+
* ```ts
168+
* const vision = new VIAM.VisionClient(machine, 'my_vision');
169+
* const captureAll = await vision.captureAllFromCamera('my_camera', {
170+
* returnImage: true,
171+
* returnClassifications: true,
172+
* returnDetections: true,
173+
* returnObjectPointClouds: true,
174+
* });
175+
* ```
176+
*
100177
* @param cameraName - The name of the camera to use for classification,
101178
* detection, and segmentation.
102179
* @param opts - The fields desired in the response.

0 commit comments

Comments
 (0)