1.父类半径为私有的,那子类继承半径怎么表示 2.父类的方法在子类中能否直接使用

1.父类半径为私有的,那子类继承半径怎么表示
2.父类的方法在子类中能否直接使用
3.能不能帮我看一下我的代码哪里错了

img

img

方法调用 后面要跟上 圆括号,如果有参数,圆括号里要加上入参;
完整代码贴出来,可以帮你修改一下

img

  • 这有个类似的问题, 你可以参考下: https://ask.csdn.net/questions/829964
  • 你也可以参考下这篇文章:(蓝桥真题)最长不下降子序列(权值线段树)
  • 除此之外, 这篇博客: 计算机视觉(二):局部图像描述子中的 5.1.1 获取图像像素块,并使用归一化的互相关矩阵进行比较 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • def get_descriptors(image,filtered_coords,wid=5):
        
        desc = []
        for coords in filtered_coords:
            patch = image[coords[0]-wid:coords[0]+wid+1,
                                coords[1]-wid:coords[1]+wid+1].flatten()
            desc.append(patch)
        
        return desc
    
    def match(desc1,desc2,threshold=0.5):
        
        n = len(desc1[0])
        
        # pair-wise distances
        d = -ones((len(desc1),len(desc2)))
        for i in range(len(desc1)):
            for j in range(len(desc2)):
                d1 = (desc1[i] - mean(desc1[i])) / std(desc1[i])
                d2 = (desc2[j] - mean(desc2[j])) / std(desc2[j])
                ncc_value = sum(d1 * d2) / (n-1) 
                if ncc_value > threshold:
                    d[i,j] = ncc_value
                
        ndx = argsort(-d)
        matchscores = ndx[:,0]
        
        return matchscores
    
    def match_twosided(desc1,desc2,threshold=0.5):
        
        matches_12 = match(desc1,desc2,threshold)
        matches_21 = match(desc2,desc1,threshold)
        
        ndx_12 = where(matches_12 >= 0)[0]
        
        # remove matches that are not symmetric
        for n in ndx_12:
            if matches_21[matches_12[n]] != n:
                matches_12[n] = -1
        
        return matches_12
    

    匹配点可视化

    def appendimages(im1,im2):
        
        # select the image with the fewest rows and fill in enough empty rows
        rows1 = im1.shape[0]    
        rows2 = im2.shape[0]
        
        if rows1 < rows2:
            im1 = concatenate((im1,zeros((rows2-rows1,im1.shape[1]))),axis=0)
        elif rows1 > rows2:
            im2 = concatenate((im2,zeros((rows1-rows2,im2.shape[1]))),axis=0)
        # if none of these cases they are equal, no filling needed.
        
        return concatenate((im1,im2), axis=1)
    def plot_matches(im1,im2,locs1,locs2,matchscores,show_below=True):
        
        im3 = appendimages(im1,im2)
        if show_below:
            im3 = vstack((im3,im3))
        
        imshow(im3)
        
        cols1 = im1.shape[1]
        for i,m in enumerate(matchscores):
            if m>0:
                plot([locs1[i][1],locs2[m][1]+cols1],[locs1[i][0],locs2[m][0]],'c')
        axis('off')
    
  • 您还可以看一下 张立铜老师的太空大战游戏实战课程课程中的 游戏业务-子弹基类设计小节, 巩固相关知识点