Commit 9734495b authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][hot pixel removal] Use median filter from silx instead of opencv

parent ba736506
......@@ -29,7 +29,7 @@ __license__ = "MIT"
__date__ = "29/11/2019"
import numpy
import cv2
import silx.math
from enum import Enum
......@@ -145,7 +145,7 @@ def hot_pixel_removal(data, ksize=3):
elif frame.dtype == numpy.float:
frame = frame.astype(numpy.float32)
corrected_frame = numpy.array(frame)
median = cv2.medianBlur(frame, ksize)
median = silx.math.medfilt(frame, ksize)
hot_pixels = numpy.subtract(frame, median, dtype=numpy.int64)
threshold = numpy.std(hot_pixels)
corrected_frame[hot_pixels > threshold] = median[hot_pixels > threshold]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment