I've got an image that I apply a Gaussian Blur to using both cv2.GaussianBlur
and skimage.gaussian_filter
libraries, but I get significantly different results. I'm curious as to why, and what can be done to make skimage
look more like cv2
. I know skimage.gaussian_filter
is a wrapper around scipy.scipy.ndimage.filters.gaussian_filter
. To clearly state the question, why are the two functions different and what can be done to make them more similar?
Here is my test image:
Here is the cv2
version (appears blurrier):
Here is the skimage
/scipy
version (appears sharper):
Details:
skimage_response = skimage.filters.gaussian_filter(im, 2, multichannel=True, mode='reflect')
cv2_response = cv2.GaussianBlur(im, (33, 33), 2)
So sigma=2 and the size of the filter is big enough that it shouldn't make a difference. Imagemagick covnert -gaussian-blur 0x2
visually agrees with cv2
.
Versions: cv2
=2.4.10, skimage
=0.11.3, scipy
=0.13.3
If anyone is curious about how to make skimage.gaussian_filter() match Matlab's equivalent imgaussfilt() (the reason I found this question), pass the parameter 'truncate=2' to skimage.gaussian_filter(). Both skimage and Matlab calculate the kernel size as a function of sigma. Matlab's default is 2. Skimage's default is 4, resulting in a significantly larger kernel by default.