【发布时间】:2018-09-26 13:11:38
【问题描述】:
任何人都知道如何转换为灰度,下面是我需要使用的一些骨架代码。具体来说,将“之前”转换为灰度, 应用 Sobel 边缘检测卷积滤波器,并存储 导致“之后”。 before 必须为非空。
template <typename color_depth> void
edge_detect(gfx::image<color_depth>& after,
const gfx::image<color_depth>& before) {
// Check arguments.
assert(!before.empty());
// TODO: replace this function body with working code. Make sure
// to delete this comment.
// Hint: Use the grayscale(...) and extend_edges(...) filters to
// prepare for the Sobel convolution. Then compute the Sobel
// operator one pixel at a time. Finally use crop_extended_edges
// to un-do the earlier extend_edges.
}
【问题讨论】: