All Questions
Tagged with gaussianblur numpy
10
questions
0
votes
2
answers
69
views
Can't seem to recreate Gaussian blur using Numpy
I want to implement Gaussian Blur (similar to cv2.GaussianBlur) using only Numpy but I can't seem to understand how to tackle the alpha channel. My code:
# 1D Gaussian PD Function
def gauss(x, sigma):
...
0
votes
0
answers
46
views
Is there a way on Python to make a matrix (in the maths sense) from a (blur) function?
Essentially, I'm trying to set up an inverse problem, of the form
Ax=y
where A is a matrix/operator (e.g. blurring) acting on an image x (which I squeeze to make an array) and y is the consequent ...
1
vote
1
answer
14k
views
error: OpenCV(4.5.4) :-1: error: (-5:Bad argument) in function 'GaussianBlur'
Trying to count number of objects in .npy image file
import numpy as np
img=np.load('A03_00Ac_Object Identities.npy')
from matplotlib import pyplot as plt
plt.imshow(img,cmap='gray')
import cv2
plt....
0
votes
1
answer
6k
views
How to generate 2d gaussian kernel using 2d convolution in python?
From my workout instruction:
A 2D Gaussian can be formed by convolution of a 1D Gaussian with its transpose.
Here is my 1d gaussian function:
def gauss1d(sigma, filter_length=11):
# INPUTS
# ...
4
votes
1
answer
5k
views
How to create noisy images for data augmentation
I followed the most upvoted answer to a question regarding adding noise to an image. However it doesn't work for me. I just want to observe different noise effects on image while using Python
How to ...
0
votes
1
answer
885
views
Gaussian filters create holes in histogram
I'm using a simple gaussian filter to blur the image in the MWE below
import imageio
import matplotlib.pyplot as plt
import numpy as np
from scipy.ndimage.filters import gaussian_filter
image = ...
2
votes
1
answer
6k
views
Linearly separating a Gaussian Filter and calculating with Numpy
I have a 2d numpy array containing greyscale pixel values from 0 to 255. What I want to do is to create a gaussian filter from scratch. I have already written a function to generate a normalized ...
0
votes
1
answer
100
views
How to turn 1D array into symmetrical 3D array?
I have a symmetrical 1D numpy array, for example, something like this:
0 1 2 1 0
How could I turn this into a 3D array (kinda similar to a gaussian kernel), with the value 2 at the center?
As an ...
0
votes
1
answer
1k
views
Drawing circles around a certain area with opencv
I am working on a code which accesses my camera, turns the output into grayscale, applies a gaussian blur finds the brightest area/pixel and circles it.
Everything but the drawing-a-circle-part works ...
56
votes
14
answers
177k
views
How to calculate a Gaussian kernel matrix efficiently in numpy?
def GaussianMatrix(X,sigma):
row,col=X.shape
GassMatrix=np.zeros(shape=(row,row))
X=np.asarray(X)
i=0
for v_i in X:
j=0
for v_j in X:
GassMatrix[i,j]=...