Skip to content

frames with small deviations #7

Answered by rfezzani
bgriffen asked this question in Q&A
Discussion options

You must be logged in to vote

To filter small intensity variations, you can apply both temporal and spatial filtering. You may also threshold estimated optical flow with small intensity:

from matplotlib import pyplot as plt
import numpy as np
from skimage.color import rgb2gray
from scipy.ndimage import gaussian_filter1d

import imageio.v3 as iio
import pyimof
from skimage.registration import optical_flow_tvl1 as tvl1
from skimage.filters import median

frames = rgb2gray(iio.imread('/tmp/Video_S1.avi', index=None))

# --- Temporal gaussian filtering
frames = gaussian_filter1d(frames, 0.5, axis=0)

# --- Spatial median filtering
radius = 1
size = 2 * radius + 1
ker = np.ones((size, size), bool)
img0 = median(frames[10], k…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rfezzani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants
Converted from issue

This discussion was converted from issue #3 on February 13, 2023 13:18.