Rotate
Rotate layer (rotate) rotates images and its annotations.

Settings

  • rotate_angles
    • min_degrees (type: number)
    • max_degrees (type: number)
  • black_regions
    • mode (type: string, enum: [keep, crop, preserve_size])
1
{
2
"action": "rotate",
3
"src": ["$data"],
4
"dst": "$result",
5
"settings": {
6
"rotate_angles": {
7
"min_degrees": -45,
8
"max_degrees": 45
9
},
10
"black_regions": {
11
"mode": "keep"
12
}
13
}
14
}
Copied!
Each image will be rotated by a random angle (around the image center, CCW) with uniform distribution from min_degrees to max_degrees. You can:
  • keep original image data (mode: keep), then new regions will be filled with black color;
  • crop rotated result to exclude black regions (mode: crop);
  • crop rotated result to preserve original image size and scale of objects (mode: preserve_size);

Example: keep

Rotate images by a random degree from -45 to 45 and keep black regions:
Original
Result
1
[
2
{
3
"dst": "$data",
4
"src": [
5
"mini_pascal/*"
6
],
7
"action": "data",
8
"settings": {
9
"classes_mapping": "default"
10
}
11
},
12
{
13
"action": "rotate",
14
"src": ["$data"],
15
"dst": "$result",
16
"settings": {
17
"rotate_angles": {
18
"min_degrees": -45,
19
"max_degrees": 45
20
},
21
"black_regions": {
22
"mode": "keep"
23
}
24
}
25
},
26
{
27
"dst": "example_rotate_keep",
28
"src": [
29
"$result"
30
],
31
"action": "supervisely",
32
"settings": {}
33
}
34
]
Copied!

Example: crop

Rotate images by a fixed degree 45 and crop black regions:
Original
Result
1
[
2
{
3
"dst": "$data",
4
"src": [
5
"mini_pascal/*"
6
],
7
"action": "data",
8
"settings": {
9
"classes_mapping": "default"
10
}
11
},
12
{
13
"action": "rotate",
14
"src": ["$data"],
15
"dst": "$result",
16
"settings": {
17
"rotate_angles": {
18
"min_degrees": 45,
19
"max_degrees": 45
20
},
21
"black_regions": {
22
"mode": "crop"
23
}
24
}
25
},
26
{
27
"dst": "example_rotate_crop",
28
"src": [
29
"$result"
30
],
31
"action": "supervisely",
32
"settings": {}
33
}
34
]
Copied!
Last modified 1yr ago