Example #1
0
    def createBlindMatchFeatures(self,
                                 stars,
                                 featurePoint=160,
                                 featureNum=10,
                                 searchRTimes=2,
                                 partitionNum=4):

        oiMatch = CrossMatch()
        oiData = oiMatch.filterStar(stars)
        brightStarOi, darkStarOi = oiMatch.getBright(oiData, featurePoint)
        '''
        tpos = brightStarOi[:,0:2].copy()
        tpos[:,0] = tpos[:,0] + 20
        self.saveReg(tpos, "data/reg%d.reg"%(stars.shape[0]), radius=4, width=1, color='green')
        '''
        oiMatch.createRegionIdx(darkStarOi, featureNum)
        #oiMatch.statisticRegions()

        searchRadius = oiMatch.regSize * searchRTimes

        tXY = []
        mchIdxs = []
        for i, ts in enumerate(brightStarOi):
            x = ts[0]
            y = ts[1]
            nN = oiMatch.getNearestN(x, y, searchRadius, featureNum)
            if len(nN) == featureNum:
                tXY.append((x, y))
                mchIdxs.append(nN)

        return tXY, mchIdxs
Example #2
0
    def createBlindMatchFeatures(self, stars, featurePointPercentage=0.1, featureNum=8, searchRTimes=2, partitionNum=4):
        
        oiMatch = CrossMatch(self.imgW, self.imgH)
        oiData = oiMatch.filterStar(stars)
        brightStarOi, darkStarOi = oiMatch.getBright(oiData, featurePointPercentage)
        print("bright star number %d"%(brightStarOi.shape[0]))
        print("dark star number %d"%(darkStarOi.shape[0]))

        '''
        tpos = brightStarOi[:,0:2].copy()
        tpos[:,0] = tpos[:,0] + 20
        self.saveReg(tpos, "data/reg%d.reg"%(stars.shape[0]), radius=4, width=1, color='green')
        '''    
        oiMatch.createRegionIdx(darkStarOi, featureNum)
        #oiMatch.statisticRegions()
        
        #print("oiMatch.regSize=%f"%(oiMatch.regSize))
        searchRadius = oiMatch.regSize*searchRTimes*10
        #print("searchRadius=%f"%(searchRadius))
        
        tXY = []
        mchIdxs = []
        for i, ts in enumerate(brightStarOi):
            x = ts[0]
            y = ts[1]
            nN = oiMatch.getNearestN(x,y, searchRadius,featureNum)
            #print("star %d match %d features"%(i, nN.shape[0]))
            if len(nN)==featureNum:
                tXY.append((x,y))
                mchIdxs.append(nN)
        
        return tXY, mchIdxs