Exemplo n.º 1
0
    def nextImage(self):
        print "Updating Image to ", self.imgFiles[self.imgIdx]
        imgFile = self.imgFiles[self.imgIdx]
        depthFile = self.depthFiles[self.imgIdx]
        #Read data, with normalization to be -1 to 1
        self.currImage = imread(imgFile).astype(np.float32) / 256
        #Here, each pixel is uint16. We change it to uint8 by dividing by 256.
        #The range will go from 0 to 255, but most depths do not exceed 128.
        self.currDepth = imread(depthFile).astype(np.float32) / 256

        #Update imgIdx
        self.imgIdx = (self.imgIdx + 1) % len(self.imgFiles)

        #Segment image
        self.currSegments = calcSegments(self.currImage)
        (segMean, segStd, segCoords,
         segLabels) = segmentDepth(self.currDepth, self.currSegments)

        #Normalize ground truth here
        self.segVals = segMean
        self.segCoords = segCoords
        self.segLabels = segLabels

        assert (len(self.segVals) == len(self.segCoords))

        #Generate shuffled index based on how many segments
        self.shuffleIdx = range(len(self.segVals))
        shuffle(self.shuffleIdx)
Exemplo n.º 2
0
    def nextImage(self):
        print "Updating Image to ", self.imgFiles[self.imgIdx]
        imgFile = self.imgFiles[self.imgIdx]
        depthFile = self.depthFiles[self.imgIdx]
        #Read data, with normalization to be -1 to 1
        self.currImage = imread(imgFile).astype(np.float32)/256
        #Here, each pixel is uint16. We change it to uint8 by dividing by 256.
        #The range will go from 0 to 255, but most depths do not exceed 128.
        self.currDepth = imread(depthFile).astype(np.float32)/256

        #Update imgIdx
        self.imgIdx = (self.imgIdx + 1) % len(self.imgFiles)

        #Segment image
        self.currSegments = calcSegments(self.currImage)
        (segMean, segStd, segCoords, segLabels) = segmentDepth(self.currDepth, self.currSegments)

        #Normalize ground truth here
        self.segVals = segMean
        self.segCoords = segCoords
        self.segLabels = segLabels

        assert(len(self.segVals) == len(self.segCoords))

        #Generate shuffled index based on how many segments
        self.shuffleIdx = range(len(self.segVals))
        shuffle(self.shuffleIdx)
Exemplo n.º 3
0
 def loadImage(self, imgFile):
     print "Updating Image to ", imgFile
     #Read data, with normalization to be -1 to 1
     self.currImage = imread(imgFile).astype(np.float32)/256
     #We don't use mean, std at all, just coords, which is unaffected by first parameter
     #Segment image
     self.currSegments = calcSegments(self.currImage)
     (segMean, segStd, segCoords, segLabels) = segmentDepth(self.currImage[:, :, 1], self.currSegments)
     self.segCoords = segCoords
     self.segLabels = segLabels