Skip to content

Commit b8dd966

Browse files
authored
DOCS-3168: Add two new features for crop transform camera (#3773)
1 parent 21f7a8e commit b8dd966

File tree

1 file changed

+69
-39
lines changed

1 file changed

+69
-39
lines changed

docs/components/camera/transform.md

+69-39
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ The following attributes are available for `transform` views:
122122

123123
The following are the transformation objects available for the `pipeline`:
124124

125-
{{< tabs >}}
126-
{{% tab name="Classifications" %}}
125+
### Classifications
127126

128127
Classifications overlay text from the `GetClassifications` method of the [vision service](/services/vision/) onto the image.
129128

@@ -151,12 +150,13 @@ Classifications overlay text from the `GetClassifications` method of the [vision
151150
- `max_classifications`: _Optional_. The maximum number of classifications to display on the camera stream at any given time. Default: `1`.
152151
- `valid_labels`: _Optional_. An array of labels that you to see detections for on the camera stream. If not specified, all labels from the classifier are used.
153152

154-
{{% /tab %}}
155-
156-
{{% tab name="Crop" %}}
153+
### Crop
157154

158155
The Crop transform crops takes an image and crops it to a rectangular area specified by two points: the top left point (`(x_min, y_min)`) and the bottom right point (`(x_max, y_max)`).
159156

157+
{{< tabs >}}
158+
{{% tab name="Template" %}}
159+
160160
```json {class="line-numbers linkable-line-numbers"}
161161
{
162162
"source": "<your-source-camera-name>",
@@ -167,23 +167,72 @@ The Crop transform crops takes an image and crops it to a rectangular area speci
167167
"x_min_px": <int>,
168168
"y_min_px": <int>,
169169
"x_max_px": <int>,
170-
"y_max_px": <int>
170+
"y_max_px": <int>,
171+
"overlay_crop_box": <bool>
171172
}
172173
}
173174
]
174175
}
175176
```
176177

177-
**Attributes:**
178+
{{% /tab %}}
179+
{{% tab name="Coordinate Example" %}}
180+
181+
If you have a 100 x 200 image, and you want to crop to a box between the points (30, 40) and (60,80), the following would suffice:
178182

179-
- `x_min_px`: The x coordinate of the top left point of the rectangular area to crop the image to.
180-
- `y_min_px`: The y coordinate of the top left point of the rectangular area to crop the image to.
181-
- `x_max_px`: The x coordinate of the bottom right point of the rectangular area to crop the image to.
182-
- `y_max_px`: The y coordinate of the bottom right point of the rectangular area to crop the image to.
183+
```json {class="line-numbers linkable-line-numbers"}
184+
{
185+
"source": "<your-source-camera-name>",
186+
"pipeline": [
187+
{
188+
"type": "crop",
189+
"attributes": {
190+
"x_min_px": 30,
191+
"y_min_px": 40,
192+
"x_max_px": 60,
193+
"y_max_px": 80,
194+
"overlay_crop_box": false
195+
}
196+
}
197+
]
198+
}
199+
```
183200

184201
{{% /tab %}}
202+
{{% tab name="Proportion Example" %}}
185203

186-
{{% tab name="Depth Edges" %}}
204+
If you have a 100 x 200 image, and you want to crop to a box between the points (30, 40) and (60,80), the following would suffice:
205+
206+
```json {class="line-numbers linkable-line-numbers"}
207+
{
208+
"source": "<your-source-camera-name>",
209+
"pipeline": [
210+
{
211+
"type": "crop",
212+
"attributes": {
213+
"x_min_px": 0.3,
214+
"y_min_px": 0.2,
215+
"x_max_px": 0.6,
216+
"y_max_px": 0.4,
217+
"overlay_crop_box": false
218+
}
219+
}
220+
]
221+
}
222+
```
223+
224+
{{% /tab %}}
225+
{{< /tabs >}}
226+
227+
**Attributes:**
228+
229+
- `x_min_px`: The x coordinate or the relative proportion of the top left point of the rectangular area to crop the image to.
230+
- `y_min_px`: The y coordinate or the relative proportion of the top left point of the rectangular area to crop the image to.
231+
- `x_max_px`: The x coordinate or the relative proportion of the bottom right point of the rectangular area to crop the image to.
232+
- `y_max_px`: The y coordinate or the relative proportion of the bottom right point of the rectangular area to crop the image to.
233+
- `overlay_crop_box`: Set to `true` to not actually carry out the crop, but instead overlay the cropping box on the original image and visualize where the crop would be applied.
234+
235+
### Depth edges
187236

188237
The Depth Edges transform creates a canny edge detector to detect edges on an input depth map.
189238

@@ -209,8 +258,7 @@ The Depth Edges transform creates a canny edge detector to detect edges on an in
209258
- `low_threshold_pct`: The low threshold value: between 0.0 - 1.0.
210259
- `blur_radius_px`: The blur radius used to smooth the image before applying the filter.
211260

212-
{{% /tab %}}
213-
{{% tab name="Depth Preprocess" %}}
261+
### Depth preprocess
214262

215263
Depth Preprocessing applies some basic hole-filling and edge smoothing to a depth map.
216264

@@ -230,9 +278,7 @@ Depth Preprocessing applies some basic hole-filling and edge smoothing to a dept
230278

231279
- None.
232280

233-
{{% /tab %}}
234-
235-
{{% tab name="Depth to Pretty" %}}
281+
### Depth to pretty
236282

237283
The Depth-to-Pretty transform takes a depth image and turns it into a colorful image, with blue indicating distant points and red indicating nearby points.
238284
The actual depth information is lost in the transform.
@@ -253,9 +299,7 @@ The actual depth information is lost in the transform.
253299

254300
- None.
255301

256-
{{% /tab %}}
257-
258-
{{% tab name="Detections" %}}
302+
### Detections
259303

260304
The Detections transform takes the input image and overlays the detections from a given detector configured within the [vision service](/services/vision/).
261305

@@ -281,9 +325,7 @@ The Detections transform takes the input image and overlays the detections from
281325
- `confidence_threshold`: Specify to only display detections above the specified threshold (decimal between 0 and 1).
282326
- `valid_labels`: _Optional_. An array of labels that you to see detections for on the camera stream. If not specified, all labels from the classifier are used.
283327

284-
{{% /tab %}}
285-
286-
{{% tab name="Identity"%}}
328+
### Identity
287329

288330
The Identity transform does nothing to the image.
289331
You can use this transform to change the underlying camera source's intrinsic parameters or stream type, for example.
@@ -303,9 +345,7 @@ You can use this transform to change the underlying camera source's intrinsic pa
303345

304346
- None
305347

306-
{{% /tab %}}
307-
308-
{{% tab name="Overlay" %}}
348+
### Overlay
309349

310350
Overlays the depth and the color 2D images.
311351
Useful to debug the alignment of the two images.
@@ -341,9 +381,7 @@ Useful to debug the alignment of the two images.
341381
- `fx`: The image focal x.
342382
- `fy`: The image focal y.
343383

344-
{{% /tab %}}
345-
346-
{{% tab name="Resize" %}}
384+
### Resize
347385

348386
The Resize transform resizes the image to the specified height and width.
349387

@@ -367,9 +405,7 @@ The Resize transform resizes the image to the specified height and width.
367405
- `width_px`: Specify the expected width for the aligned image. Value must be >= 0.
368406
- `height_px`: Specify the expected width for the aligned image. Value must be >= 0.
369407

370-
{{% /tab %}}
371-
372-
{{% tab name="Rotate" %}}
408+
### Rotate
373409

374410
The Rotate transformation rotates the image by the angle specified in `angle_deg`. Default: 180 degrees.
375411
This feature is useful for when the camera is installed upside down or sideways on your machine.
@@ -392,9 +428,7 @@ This feature is useful for when the camera is installed upside down or sideways
392428

393429
- `angle_deg`: Rotate the image by a specific angle in degrees.
394430

395-
{{% /tab %}}
396-
397-
{{% tab name="Undistort" %}}
431+
### Undistort
398432

399433
The Undistort transform undistorts the input image according to the intrinsic and distortion parameters specified within the camera parameters.
400434
Currently only supports a Brown-Conrady model of distortion (20 September 2022).
@@ -444,10 +478,6 @@ For further information, please refer to the [OpenCV docs](https://docs.opencv.o
444478
- `tp1`: The tangential distortion x.
445479
- `tp2`: The tangential distortion y.
446480

447-
{{% /tab %}}
448-
449-
{{< /tabs >}}
450-
451481
## Example
452482

453483
```json {class="line-numbers linkable-line-numbers"}

0 commit comments

Comments
 (0)