Esempio n. 1
0
 def __init__(self, max, figureName=None):
     SetVisitor.__init__(self)
     self.frame = IntervalVector(2, max*Interval(-1, 1))
     self.figureName = figureName
     if figureName != None:
         vibes.newFigure(figureName)
         vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 500, 'height': 500})
Esempio n. 2
0
def export_data(Y, T):
    vibes.newFigure('Data')
    vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 1000, 'height': 1000})
    print("#" * 50)
    print("Data to use")
    for i, (y, t) in enumerate(zip(Y[::-1], T[::-1])):
        # print(" %d & %s & %s \\\\ \\hline"%(i+1,t,y))
        print("\\draw[boxColor] (%f, %f) rectangle (%f, %f);" %
              (t[0], y[0], t[1], y[1]))
        # vibes.drawBox(t[0], t[1], y[0], y[1], 'k[lightGray]')
    print("#" * 50)
Esempio n. 3
0
 def __init__(self, max, figureName=None):
     SetVisitor.__init__(self)
     self.frame = IntervalVector(2, max * Interval(-1, 1))
     self.figureName = figureName
     if figureName != None:
         vibes.newFigure(figureName)
         vibes.setFigureProperties({
             'x': 0,
             'y': 0,
             'width': 500,
             'height': 500
         })
    # SIVIA test for Gascogne Golf
    img = cv2.imread('Gascogne2.png',0) #Read the image of the Gascogne Golf in the gray color
    retval, img_bin = cv2.threshold(img, 254, 1, cv2.THRESH_BINARY_INV) #Binarisation of the image
    imgIntegral = cv2.integral(img_bin) #Calcul of the integral of the image
    j_max,i_max=imgIntegral.shape #Dimension of the image
    pdcGascogne = ImageToBoxes(imgIntegral,i0,j0,echellePixel) #Creation of an object of the class PavageGascogne    
    
    #Area of calcul / First box for SIVIA algorithm
    X0=IntervalVector([[-i0*echellePixel, (-i0+i_max-1)*echellePixel], [(j0-j_max+1)*echellePixel, j0*echellePixel]]) 

    imgOut=np.zeros((j_max, i_max),dtype="uint8")

    #Definition of the draw window:
    vibes.beginDrawing()
    vibes.newFigure('Robotique')
    vibes.setFigureProperties(dict(x=600, y=200, width=j_max, height=i_max))
    vibes.axisLimits(X0[0].lb(),X0[0].ub(),X0[1].lb(),X0[1].ub())
    
    #Loop
    for i in range(100):
        
        for r in range(nbsRobots):
            m[r][0] = Interval(position[i][r][1]).inflate(PositionIncertitude) #x
            m[r][1] = Interval(position[i][r][2]).inflate(PositionIncertitude) #y
        t = m[i][0][0]
        
        #SIVIA test for Robots secure area whith incertitude
        pdcRobots = IncertitudeRobots(m,r**2)
    
        # SIVIA test for Trail
        sizeKernelErosion = enemySpeed*(t-t_old)/(1000*echellePixel)
Esempio n. 5
0
    p1=math.pi
    p2=0
    p3=math.pi/2
    
    # commande
    u1=[1,0]
    u2=[1,0]
    u3=[1,0]
    
    # simulation
    h=0.7
    

    vibes.beginDrawing()
    vibes.newFigure('Zone de non detection')
    vibes.setFigureProperties({'x':500, 'y':100, 'width':800, 'height':800})
    
    # # test unitaire
    # m= [[cx1 , cy1 ],[cx2, cy2],[cx3, cy3]]
    # pdc = test3(m)
    # #vibes.clearFigure()
    # SIVIA(X0, pdc, 0.5)
    # 
    # for m_ in m:
    #     vibes.drawCircle(m_[0].mid(), m_[1].mid(), 0.2, '[k]')
    # vibes.drawArrow([-15, -15], [-15, -10], 1, 'w[w]')
    # vibes.drawArrow([-15, -15], [-10, -15], 1, 'w[w]')
    
    
    for t in range(10):
        time1 = time.time()
Esempio n. 6
0
vibes.drawPie([0,0], [3,4], [45, 90])

vibes.newGroup("Pie", figure="test", format='[cyan]')
vibes.drawPie([0,0], [5,9], [-120, -40], group="Pie")
# vibes.drawPie([0,0], [5,9], [-120, -40], "[b]")

vibes.drawPie([5,2], [1,2], [160, 220]) #, 'g[y]')

# vibes.clearGroup("Pie", figure="test")

vibes.drawPie([0,0], [1,2], [160, 220]) #, 'g[y]')


# exit()
vibes.newFigure("test2")
vibes.setFigureProperties({'x':0, 'y':0, 'width':600, 'height':600})

# vibes.axisLimits(10,20,10,20)
vibes.axisLabels("titi", "toto")
# vibes.drawBox(-1,0,-4,-6,color='[r]', figure='test2')



# vibes.selectFigure("test")
# vibes.clearFigure()
# vibes.selectFigure("test2")
# vibes.saveImage('./test.svg', "test")
# vibes.closeFigure("test2")

vibes.drawBoxDiff([11, 13, 11, 24], [12,12.5, 11, 13], 'b[r]')
Esempio n. 7
0
def newFigure(name):
	vibes.newFigure(name)
	vibes.setFigureProperties({'x':0, 'y':0, 'width':1024, 'height':500, 'viewbox':'equal'})
	vibes.axisLimits(x_min-offset, x_max+offset, y_min-offset, y_max+offset)
	vibes.drawBox(x_min-offset, x_max+offset, y_min-offset, y_max+offset, "white[white]")
Esempio n. 8
0
vibes.drawPie([0, 0], [3, 4], [45, 90])

vibes.newGroup("Pie", figure="test", format='[cyan]')
vibes.drawPie([0, 0], [5, 9], [-120, -40], group="Pie")
# vibes.drawPie([0,0], [5,9], [-120, -40], "[b]")

vibes.drawPie([5, 2], [1, 2], [160, 220])  #, 'g[y]')

# vibes.clearGroup("Pie", figure="test")

vibes.drawPie([0, 0], [1, 2], [160, 220])  #, 'g[y]')

# exit()
vibes.newFigure("test2")
vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 600, 'height': 600})

# vibes.axisLimits(10,20,10,20)
vibes.axisLabels("titi", "toto")
# vibes.drawBox(-1,0,-4,-6,color='[r]', figure='test2')

# vibes.selectFigure("test")
# vibes.clearFigure()
# vibes.selectFigure("test2")
# vibes.saveImage('./test.svg', "test")
# vibes.closeFigure("test2")

vibes.drawBoxDiff([11, 13, 11, 24], [12, 12.5, 11, 13], 'b[r]')

vibes.drawArrow([9, 9], [9, 10], 0.3, '[r]')
vibes.drawArrow([9, 9], [10, 9], 0.3, '[r]')
Esempio n. 9
0
    (x, y) = yield vibes.drawCircle(x, y, 1, "g[m]")
    (x, y) = yield vibes.drawEllipse(x, y, 2, 1, 45, color="r[darkCyan]")
    (x, y) = yield vibes.drawLine([[x - 0.5, y - 1], [x + 1, y + 0.5]], "k")
    (x, y) = yield vibes.drawPie((x - 2, y - 2), (1, 2.5), [20, 70], "y[cyan]")
    (x,
     y) = yield vibes.drawPolygon([[x - 1, y - 1], [x, y + 1], [x + 1, y - 1]],
                                  "k[orange]")
    (x, y) = yield vibes.drawRing(x, y, 1, 2, '[red]')
    # (x,y) = yield vibes.drawPie( (x, y), (1,2), [0,360] , "y[cyan]")
    (x, y) = yield vibes.drawVehicle(x, y, 20, 1, "[darkBlue]")
    (x, y) = yield vibes.drawPoint(x, y, 1, "[k]")
    (x, y) = yield vibes.drawText(x, y, "Text", 1)


vibes.beginDrawing()
vibes.newFigure("example")
vibes.setFigureProperties({"x": 100, "y": 100, "width": 500, "height": 500})

dd = shapeGen()
dd.send(None)
# dd.next()
for x in range(0, 14, 4):
    for y in range(0, 14, 4):
        try:
            dd.send((y, -x))
        except StopIteration:
            # print("stop iter")
            break

vibes.axisEqual()
Esempio n. 10
0
from vibes import vibes
from pyIbex import PixelMap2D, CtcPixelMap, IntervalVector, Interval
from scipy import misc
import numpy as np
"""
Example : image contractor
"""

# Generate the image using vibes
# Only use for drawing
vibes.beginDrawing()
vibes.newFigure('Map')
vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 500, 'height': 500})
vibes.drawCircle(4, 4, 3, '[k]')
vibes.drawLine([[-3, -1], [7, -1]], '[k]')
vibes.drawLine([[7, -1], [7, 1]], '[k]')
vibes.axisLimits(-4, 8, -4, 8)

# Read the image and extract the last layer
img = misc.imread('./img.png')[:, :, 3]
# normalize in order to have a binary image.
img = img / np.max(img)
if np.max(img) != 1:
    print("Error, img must be a binary image")

# convert img into a unsigned int64 image type
img = img.astype(np.uint64)
# vertical flip to inverse the y axis
img = np.flipud(img)

# PixelMap2D constructor takes :
	(x,y) = yield vibes.drawAUV(x,y,45,2, 'k[y]')
	(x,y) = yield vibes.drawBox(x-1,x+1,y-2,y+2, "[b]")
	(x,y) = yield vibes.drawBoxesUnion([[x-1,x,y-2,y], [x-0.5,x+1,y-0.5,y+2]], "[r]")
	(x,y) = yield vibes.drawCircle(x,y,1, "g[m]")
	(x,y) = yield vibes.drawEllipse(x,y,2,1,45, color="r[darkCyan]")
	(x,y) = yield vibes.drawLine([[x-0.5, y-1], [x+1, y+0.5]], "k")
	(x,y) = yield vibes.drawPie( (x-2, y-2), (1,2.5), [20,70] , "y[cyan]")
	(x,y) = yield vibes.drawPolygon([[x-1,y-1], [x, y+1], [ x+1, y-1]], "k[orange]")
	(x,y) = yield vibes.drawRing(x,y, 1,2, '[red]')
	# (x,y) = yield vibes.drawPie( (x, y), (1,2), [0,360] , "y[cyan]")
	(x,y) = yield vibes.drawVehicle( x, y, 20, 1, "[darkBlue]")
	(x,y) = yield vibes.drawPoint( x,y, 1, "[k]")
	(x,y) = yield vibes.drawText( x,y, "Text", 1)

vibes.beginDrawing()
vibes.newFigure("example")
vibes.setFigureProperties( { "x": 100,"y": 100,"width": 500,"height": 500} )

dd =shapeGen()
dd.send(None)
# dd.next()
for x in range(0,14,4):
	for y in range(0,14,4):
		try:
			dd.send((y,-x))
		except StopIteration:
			# print("stop iter")
			break

vibes.axisEqual()