-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Description
In Chapter 3.2.1, there is an implementation of sliding the filter over the input:
filter = [1, 0, -1]
input = [1, 0, 2, -1, 1, 2]
output = []
for i in range(len(input) - len(filter)):
result = 0
for j in range(len(filter)):
result += input[i+j] * filter[j]
output.append(result) The first loop does not catch the last possible slide, so it should be:
filter = [1, 0, -1]
input = [1, 0, 2, -1, 1, 2]
output = []
for i in range(len(input) - len(filter) + 1):
result = 0
for j in range(len(filter)):
result += input[i+j] * filter[j]
output.append(result) PS: @EdwardRaff your book is absolutely brilliant!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels