Sort by

recency

|

7 Discussions

|

  • + 0 comments

    There is no "middle pixel". The number of columns in the image is even, so there are two "middle pixels". Also, what's with all the weird, esoteric terminology with no definitions given? If you're going to use incredibly specific terminology to the field at hand, at least provide a link to definitions of your terms if not placing the definitions directly in the problem description. ie, what does "structuring element" mean, and what does "applying" it mean, etc, etc..

  • + 0 comments

    At No additional cost to you, we Ceramic Cookware will earn a small commission, if you purchase them. Please note that these are products we know/use and recommend.

  • + 1 comment
    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(dilation(a,s), return_counts=True)
    print("dilation", freq[1])
    
    unique, freq = np.unique(erosion(a,s), return_counts=True)
    print("erosion", freq[1])
    
    
    unique, freq = np.unique(closing(a,s), return_counts=True)
    print("closing", freq[1])
    
    # plt.imshow(dilation(a,s), cmap='gray')
    # plt.show()
    
  • + 0 comments

    Minor typo: "its ", not "its' " :)

  • + 2 comments

    I think the question should mention that the assumption is that the boundary pixels should be padded with 0's not 1's :)