def plotSuperPixelImage(sourceImage, labelledImage, orientation):
    print "\n*Now plotting source & labelled image for visual comparison."
    
    plt.interactive(1)
    plt.figure()
    
    pomio.showClassColours()
    plt.figure()
    
    print "*Unique labels from superpixel classification = ", np.unique(labelledImage)
    plt.subplot(1,2,1)
    plt.imshow(sourceImage, origin=orientation)
    
    plt.subplot(1,2,2)
    #pomio.showLabels(labelledImage)
    plt.imshow(labelledImage, origin=orientation)
Exemplo n.º 2
0
def plotSuperPixelImage(sourceImage, labelledImage, orientation):
    print "\n*Now plotting source & labelled image for visual comparison."

    plt.interactive(1)
    plt.figure()

    pomio.showClassColours()
    plt.figure()

    print "*Unique labels from superpixel classification = ", np.unique(
        labelledImage)
    plt.subplot(1, 2, 1)
    plt.imshow(sourceImage, origin=orientation)

    plt.subplot(1, 2, 2)
    #pomio.showLabels(labelledImage)
    plt.imshow(labelledImage, origin=orientation)
Exemplo n.º 3
0
cmap = [\
    ( (  0,255,  0),(  0,128,  0) ), \
    ( (200,100, 20),(128,128,  0) ), \
    ( (255,  0,  0),(128,  0,  0) ), \
    ( (  0,  0,255),( 64,128,  0) ), \
    ( (100,100,100),(128, 64,128) ), \
]

infile = sys.argv[1]
outfile= sys.argv[2]

image = skimage.io.imread(infile)

plt.interactive(1)
plt.figure()
pomio.showClassColours()


plt.figure()
plt.imshow(image)
plt.title('input labels')

#plt.waitforbuttonpress()

# Make the output image
newimg = image.copy()
# for each colour make the transfer
nc = 3 # number colour channels

for cpair in cmap:
    clrFrom = cpair[0]
  nbClasses = pomio.getNumClasses()

  cpnew = np.zeros( (nbRows, nbCols, nbClasses) )
  for i in range( classProbs.shape[2] ):
      # stuff this set of probs to new label
      cpnew[:,:,clfr.classes_[i]] = classProbs[:,:,i] 
  classProbs = cpnew
  del cpnew

maxLabel = np.argmax( classProbs, 2 )

pomio.showLabels(maxLabel, colourMap)
if args.verbose:
  plt.title('raw clfr labels')
  plt.figure()
  pomio.showClassColours( classNames, colourMap )

  plt.draw()
  if 0 and args.interactive:
    plt.waitforbuttonpress()

#print classProbs

if dbgMode and args.verbose:
    for i in range( classProbs.shape[2] ):
        plt.imshow( classProbs[:,:,i] )
        plt.title( 'class %d: %s' % (i,classNames[i]) )
        plt.waitforbuttonpress()

nhoodSz = args.nhoodSz
sigsq = amntools.estimateNeighbourRMSPixelDiff(imgRGB,nhoodSz) ** 2