Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
e093bb13
Commit
e093bb13
authored
Oct 13, 2018
by
kuonangzhe
Committed by
Kai Chen
Oct 13, 2018
Browse files
Update image.md: fix inconsistent API (#19)
Update old crop_img and pad_img to imcrop and impad
parent
da39212f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
docs/image.md
docs/image.md
+8
-8
No files found.
docs/image.md
View file @
e093bb13
...
...
@@ -116,18 +116,18 @@ mmcv.imflip(img, direction='vertical')
import
mmcv
import
numpy
as
np
img
=
mmcv
.
read
_img
(
'tests/data/color.jpg'
)
img
=
mmcv
.
im
read
(
'tests/data/color.jpg'
)
# crop the region (10, 10, 100, 120)
bboxes
=
np
.
array
([
10
,
10
,
100
,
120
])
patch
=
mmcv
.
crop
_img
(
img
,
bboxes
)
patch
=
mmcv
.
im
crop
(
img
,
bboxes
)
# crop two regions (10, 10, 100, 120) and (0, 0, 50, 50)
bboxes
=
np
.
array
([[
10
,
10
,
100
,
120
],
[
0
,
0
,
50
,
50
]])
patches
=
mmcv
.
crop
_img
(
img
,
bboxes
)
patches
=
mmcv
.
im
crop
(
img
,
bboxes
)
# crop two regions, and rescale the patches by 1.2x
patches
=
mmcv
.
crop
_img
(
img
,
bboxes
,
scale_ratio
=
1.2
)
patches
=
mmcv
.
im
crop
(
img
,
bboxes
,
scale_ratio
=
1.2
)
```
### Padding
...
...
@@ -135,14 +135,14 @@ There are two methods `impad` and `impad_to_multiple` to pad an image to the
specific size with given values.
```
python
img
=
mmcv
.
read
_img
(
'tests/data/color.jpg'
)
img
=
mmcv
.
im
read
(
'tests/data/color.jpg'
)
# pad the image to (1000, 1200) with all zeros
img_
=
mmcv
.
pad
_img
(
img
,
(
1000
,
1200
),
pad_val
=
0
)
img_
=
mmcv
.
im
pad
(
img
,
(
1000
,
1200
),
pad_val
=
0
)
# pad the image to (1000, 1200) with different values for three channels.
img_
=
mmcv
.
pad
_img
(
img
,
(
1000
,
1200
),
pad_val
=
[
100
,
50
,
200
])
img_
=
mmcv
.
im
pad
(
img
,
(
1000
,
1200
),
pad_val
=
[
100
,
50
,
200
])
# pad an image so that each edge is a multiple of some value.
img_
=
mmcv
.
impad_to_multiple
(
img
,
32
)
```
\ No newline at end of file
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment