Image filtering: pyramids: Laplacian pyramid

Поділитися
Вставка
  • Опубліковано 3 січ 2025

КОМЕНТАРІ • 7

  • @lbridgetiv4
    @lbridgetiv4 11 місяців тому +7

    Your videos are great! Thank you for sharing!

  • @richutrapbands
    @richutrapbands 21 день тому

    Incredible video, visuals were helpful and you explained the concept clearly

  • @mrtom-a-hawk6732
    @mrtom-a-hawk6732 9 місяців тому +2

    Wow such a clear and concise video! And you make sure to review material that student should know! Amazing

  • @MatinRafiei
    @MatinRafiei 7 місяців тому +1

    Very clear explanation, thank you

  • @afrinsultana703
    @afrinsultana703 5 місяців тому

    can anyone give me the correct step for the laplacian pyramid??
    1. Take the image fi from stage i.
    2. filter the image fi with a low pass filter and thus create the image Li
    3. Downsample the image li and thus create the image fi+1
    4. Calculate the difference image hi=fi-li
    5. cache hi
    6. Consolidate all images hi
    7. Repeat the above step n times.

    • @hanyfarid5019
      @hanyfarid5019  5 місяців тому

      Here is some Python code for computing a Laplacian pyramid:
      # Laplacian pyramid
      import matplotlib.pyplot as plt
      import numpy as np
      import cv2
      from scipy.signal import sepfir2d
      im = plt.imread( 'mandrill.png' ) # load image
      h = [1/16,4/16,6/16,4/16,1/16]; # blur filter
      N = 4 # number of pyramid levels
      # Gaussian pyramid
      G = []
      G.append(im) # first pyramid level
      for k in range(1,N): # pyramid levels
      im2 = np.zeros( im.shape )
      for z in range(3):
      im2[:,:,z] = sepfir2d( im[:,:,z], h, h ) # blur each color channel
      im2 = im2[0:-1:2, 0:-1:2,:] # down-sample
      im = im2
      G.append(im2)
      # Laplacian pyramid
      L = []
      for k in range(0,N-1): # pyramid levels
      l1 = G[k]
      l2 = G[k+1]
      l2 = cv2.resize(l2, (0,0), fx=2, fy=2) # up-sample
      D = l1 - l2
      D = D - np.min(D) # scale in [0,1]
      D = D / np.max(D) # for display purposes
      L.append(D)
      L.append(G[N-1])
      # display pyramid
      fig, ax = plt.subplots(nrows=1, ncols=N, figsize=(15, 7), dpi=72,
      sharex=True, sharey=True)
      for k in range(N-1,-1,-1):
      ax[k].imshow(L[k])

    • @afrinsultana703
      @afrinsultana703 5 місяців тому

      @@hanyfarid5019 Thank you so much for the reply would you please give me the correct algorithm step for this one?