Scaling by two-fold

This is a bonus section for scaling/resizing. The JuliaImages package has a very useful function called somepkg(restrict), which reduces the size of an image by two-fold along the dimensions specified. In other words, it scales the image by 50%.

restrict can be run in three ways:

  • Without an additional argument—the image will become twice as small in width and height
  • Sending 1 as an argument will make the height twice as small
  • Sending 2 as an argument will make the width twice as small

Let's run a demo. Try sending 1 as an additional argument so that we decrease the height by 50%:

Consider the following code:

 using Images ...

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.