How to do real time blob detection?

  binary-data, blob, python, real-time

So, I have the script below which lets me choose an image, turn it to a binary image and then detect blobs on that binary image. The final output is the original input image and next to it the binary one with circles around the detected blobs. How can I make it so that I put an input video and the final output will be the original video and binary video with blob detection on every frame?

import numpy as np
from import imshow, imread
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
sample = imread('images/0002.png')
sample_g = rgb2gray(sample)           #add an image and make it grayscale

sample_b = sample_g > 0.999           #turn the image to binary image

from skimage.feature import blob_dog, blob_log, blob_doh
fig, ax = plt.subplots(1,2,figsize=(10,5))
ax[0].set_title('Binarized Image',fontsize=15)
blobs = blob_log(sample_b, max_sigma=30, threshold=0.01)
ax[1].imshow(sample_b, cmap='gray')
for blob in blobs:
    y, x, area = blob
    ax[1].add_patch(plt.Circle((x, y), area*np.sqrt(2), color='b', 
ax[1].set_title('Using LOG',fontsize=15)

Thanks in advance!

Source: Python Questions