Padding by duplicating content from an image

Sometimes, you might like to use the content of an image to create borders. Julia has four different types (styles) you can use when growing the border. These are mentioned in the following table:

Type Description Example
:replicate The border pixels extend beyond the image boundaries UUUU - UVWXYZ - ZZZZ
:circular The border pixels wrap around WXYZ - UVWXYZ - UVWX
:symmetric The border pixels reflect relative to a position between pixels YXWV - UVWXYZ - YXWV
:reflect The border pixels reflect relative to the edge itself XWVU - UVWXYZ - ZYXW

 

For example, using :reflect would copy or mirror the border pixels. This is shown in the following code:

using Images, ImageViewpad_vertical ...

Get Hands-On Computer Vision with Julia now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.