Question: with the given julia code: abstract type AbstractStencil end struct AverageStencil < : AbstractStencil end apply _ to _ 3 x 3 ( s::AverageStencil, A
with the given julia code:
abstract type AbstractStencil end
struct AverageStencil : AbstractStencil end
applytoxs::AverageStencil, A sumA lengthA
function stencildemos::AbstractStencil
count
plotnextA subplotcount imshowA::
for noise
A testimage noise
plotnextA
plotnextapplystencilsA
end
end
function applystencils::AbstractStencil, A
# Your code
B A
for i :sizeA j :sizeA
Bij applytoxsA
end
return B
end
In Julia code: define a new subtype EdgeStencil which applies the same operation as maxabsgradfilter in the lecture notes.
here is the function from the lecture notes
function imagemaxabsgradfilterA
B A
for i :sizeA j :sizeA
a Ai:i j:j
Bij maxabsa a absa a
end
return B
end
then test with
stencildemoEdgeStencil
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
