- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
Tensorflow 中是否有任何卷积
方法可以将 Sobel 滤波器应用于图像 img
(类型为 float32
且秩为 2 的张量)?
sobel_x = tf.constant([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], 'float32')
result = tf.convolution(img, sobel_x) # <== TO DO THIS
我已经看过 tf.nn.conv2d
但我看不到如何将它用于此操作。有什么方法可以使用 tf.nn.conv2d
来解决我的问题吗?
最佳答案
也许我在这里遗漏了一个微妙之处,但您似乎可以使用 tf.expand_dims()
将 Sobel 过滤器应用于图像和 tf.nn.conv2d()
,如下:
sobel_x = tf.constant([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]], tf.float32)
sobel_x_filter = tf.reshape(sobel_x, [3, 3, 1, 1])
sobel_y_filter = tf.transpose(sobel_x_filter, [1, 0, 2, 3])
# Shape = height x width.
image = tf.placeholder(tf.float32, shape=[None, None])
# Shape = 1 x height x width x 1.
image_resized = tf.expand_dims(tf.expand_dims(image, 0), 3)
filtered_x = tf.nn.conv2d(image_resized, sobel_x_filter,
strides=[1, 1, 1, 1], padding='SAME')
filtered_y = tf.nn.conv2d(image_resized, sobel_y_filter,
strides=[1, 1, 1, 1], padding='SAME')
关于python - Tensorflow 中是否有卷积函数来应用 Sobel 滤波器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35565312/
所以我试图增强我的图像的对比度,我发现一位绅士通过在线 Gamma 校正来做到这一点,代码如下: (im/255).^0.45*255 据我了解,1/gammavalue = 0.45,其中 gamm
我有一个包含简单时间序列数据的向量(从 deSolve 矩阵中提取),用于测试目的可以是: x x r for (n in 2:length(x)) r[n] (r) [1] NA 1 1
我有这段实现 Prewitt 边缘检测的代码。我需要做的是只用一个缓冲区来实现它,也就是说,我不会创建图像的拷贝,而是编辑原始图像。所以如果我想改变值 78 的像素,我不能把新值,例如100,直到所有
我想制作一个 FIR 滤波器。我有一个系数数组 (buffer[size]) 和一个数据数组 (filter[size_filter])。我必须在两个数组之间进行卷积: for(j = 0;j < s
我正在尝试制作 IIR 滤波器。我做了FIR滤波器,但是我觉得IIR比FIR难。 我认为 IIR 与 FIR 类似,但它让我感到困惑。 我觉得过滤器是这样的 FIR : y(n) = b0(x[n])
我想在 Python 中通过窗口创建一个基本的高通 FIR 滤波器。 我的代码在下面并且是故意惯用的 - 我知道你可以(很可能)用 Python 中的一行代码完成它,但我正在学习。我使用了一个带有矩形
我正在尝试用树莓派创建一个相机来检测在走廊中移动的人(这里我假设只有移动的东西是人),并识别那些在该区域花费太多时间的人(使用计时器),我使用背景减法来检测运动并尝试使用基于相关性的跟踪器(例如 MO
我正在研究用于特征提取的超像素。我已经成功地将超像素功能应用于图像。 A = imread('kobi.png'); [L,N] = superpixels(A,5); figure BW = bou
你好 我需要在应用中使用这个 Kolmogorov 过滤器。您将一些测量数据放入其中,并使用过滤器对其进行一些平滑处理。我试着用“nchoosek”来做,但是当我尝试为 50 或更多的 I 做这件事时
我正在尝试在具有静态掩码 5x5 并在 applyFilter() 函数中进行卷积编码的图像上实现 LoG 过滤器。然而,无论我使用什么面具,我都会得到奇怪的结果。保存图像而不通过函数传递它是有效的,
我已经在 Haskell 中实现了一个 FIR 滤波器。我不太了解 FIR 滤波器,我的代码很大程度上基于现有的 C# 实现。因此,我觉得我的实现有太多的 C# 风格,而不是真正的 Haskell 风
我需要制作一个简单的带通音频滤波器。现在我使用了这个简单的 C++ 类:http://www.cardinalpeak.com/blog/a-c-class-to-implement-low-pass
CUDA NPP 库支持使用 nppiFilter_8u_C1R 命令过滤图像,但不断出现错误。我可以毫无问题地启动并运行 boxFilterNPP 示例代码。 eStatusNPP = nppiFi
我是 OpenCV 和 gabor 过滤器的新手,只想获得这样的 gabor 小波: 我在 Java 中使用这个 OpenCV 代码: double sigma_bar = 40; double th
我正在使用 FIR 滤波器对音频进行过采样。这是一个简单的典型窗口 sinc,即一个被截断和窗口化的 sinc 函数。像往常一样,它需要过去和“ future ”的样本才能工作。实际上,这意味着音频输
目前我正在尝试实现 FIR 低通滤波器。 FIR 系数在 MATLAB 中计算。现在我需要用 C++ 实现 FIR 算法。 我将一个类定义为过滤器,将 FIR 的一个函数定义为: double * F
我有一个用 C 语言实现 FIR 滤波器的家庭作业,我想知道您是否认为我理解正确。我认为解决问题的程序是: #include float FIRfloats[5]; void floatFIR(fl
我希望对图像的每条水平线应用频域滤波器,例如低通或带通。这可能使用 opencv 吗? 最佳答案 我认为您需要详细说明您的问题。也许,举一些具体的例子。 如果我将您的问题解释为: 你有一张 10 x
我的问题与 A. Levy 的解释相关: Analyze audio using Fast Fourier Transform 如何在这些复数上生成带通滤波器... [-636.00000000 +0
FIR 滤波器有一个算法,但它是 float : FIR filter implementation in C programming 如果我想要一个符合此规范的定点算法,我该怎么做? the FIR
我是一名优秀的程序员,十分优秀!