You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/examples/spatial_transformation/SpatialTransformations.jl
+23-15Lines changed: 23 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,22 @@
1
1
# ---
2
2
# title: Cropping, Resizing and Rescaling
3
-
# cover: assets/lighthouse.png
3
+
# cover: assets/transformations.gif
4
4
# author: Ashwani Rathee
5
5
# date: 2020-11-24
6
6
# ---
7
7
8
-
# This demonstration shows how to use cropping,resizing and rescaling operations on an
8
+
# This demonstration shows how to use cropping,resizing and rescaling operations on an
9
9
# image in Julia using ImageTransformations.jl
10
10
11
-
using Images, ImageTransformations, TestImages, OffsetArrays
11
+
using Images, TestImages, OffsetArrays
12
+
## ImageTransformations is reexported by Images
12
13
## load an example image
13
-
img_source =testimage("lighthouse")
14
+
img_source =testimage("lighthouse")
14
15
15
16
# ## Cropping Operation
16
17
17
-
# Cropping is one of the most basic photo manipulation processes, and it is carried out to
18
-
# remove an unwanted object or irrelevant noise from the periphery of a photograph, to
18
+
# Cropping is one of the most basic photo manipulation processes, and it is carried out to
19
+
# remove an unwanted object or irrelevant noise from the periphery of a photograph, to
19
20
# change its aspect ratio, or to improve the overall composition.
20
21
21
22
# Let's first check the size of the image
@@ -29,7 +30,7 @@ img_size = size(img_source)
29
30
# !!! tip
30
31
# An related issue about the memory order is the indexing performance, see [Performance Tips](https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-column-major) for more details.
31
32
32
-
# Let's crop the image from sides by 1/8 of img_source each side and leave it as it is from
33
+
# Let's crop the image from sides by `1/8` of `img_source` each side and leave it as it is from
33
34
# top to bottom.
34
35
35
36
# Easiest way to do this is indexing: `img_source[y1:y2, x1:x2]`
@@ -45,7 +46,10 @@ size(img_cropped)
45
46
46
47
# We can also do size-preserved cropping of the image by replacing the contents of image to white pixels or transparent pixels using PaddedView:
0 commit comments