1

I'm using this notebook provided by the Computational Thinking course and am running into an error when I execute this code.

import Pkg
Pkg.add(["Images", "ImageIO", "ImageMagick"])
using Images

philip_file = download("https://i.imgur.com/VGPeJ6s.jpg")
philip = let
       original = Images.load(philip_file)
       decimate(original, 8)
end

This is the error I see:

[ Info: Precompiling ImageMagick [6218d12a-5da1-5696-b52f-db25d2ecc6d1]
ERROR: UndefVarError: decimate not defined
Stacktrace:
 [1] top-level scope at REPL[6]:3

The notebook has not defined decimate anywhere, and looking online, I can't seem to find the function using a Google search. There is no instruction in the exercise that I might have to define the function myself. My understanding is that this function is built into one of the modules. My import of the Images module worked just fine. Can anyone help me understand what I might be doing wrong?

Note: There is a Discord community for the course but the link isn't working, so I have exhausted all those avenues.

whyharsha
  • 87
  • 6

1 Answers1

1

The decimate function seems to be defined in that same notebook, by:

decimate(image, ratio=5) = image[1:ratio:end, 1:ratio:end]
François Févotte
  • 19,520
  • 4
  • 51
  • 74