Sort by

recency

|

5 Discussions

|

  • + 0 comments

    import numpy as np import cv2

    a = np.array([[0,0,0,0,0,0,0,0,0,0],[0,1,1,1,1,1,1,1,0,0],[0,0,0,0,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,1,1,1,0,0], [0,0,0,0,1,1,1,1,0,0], [0,0,0,1,1,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0] ],np.uint8)

    s = np.array([ [1,1,1], [1,1,1], [1,1,1]],np.uint8) img_dilation = cv2.erode(a, s, iterations=1)

    unique, freq = np.unique(dilation(a,s), return_counts=True)

    print(freq[1])

    print(np.count_nonzero(img_dilation))

  • + 0 comments
    import numpy as np
    import matplotlib.pyplot as plt
    from skimage.io import imread, imshow
    from skimage.draw import disk
    from skimage.morphology import (erosion, dilation, closing, opening,
                                    area_closing, area_opening)
    from skimage.color import rgb2gray
    
    a = np.array([
        [0,0,0,0,0,0,0,0,0,0],
        [0,1,1,1,1,1,1,1,0,0],
        [0,0,0,0,1,1,1,1,0,0],
        [0,0,0,0,1,1,1,1,0,0],
        [0,0,0,1,1,1,1,1,0,0],
        [0,0,0,0,1,1,1,1,0,0],
        [0,0,0,1,1,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0],
        [0,0,0,0,0,0,0,0,0,0]
    ])
    
    s = np.array([
            [1,1,1],
            [1,1,1],
            [1,1,1]])
    
    unique, freq = np.unique(erosion(a,s), return_counts=True)
    print(freq[1])
    
    unique, freq = np.unique(erosion(a,s), return_counts=True)
    print(freq[1])
    
  • + 0 comments

    Anyone know how to set the input?

  • + 1 comment

    Anyone know how to set the input?

  • + 0 comments

    http://users.utcluj.ro/~raluca/ip_2014/ipl_07e.pdf To learn about erosion, refer this link!

No more comments