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)
        print(sizeKernelErosion)
Esempio n. 2
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]")
import math as m
from pyIbex import *
from vibes import vibes
import time
from SaveLoadData import *


if __name__ == '__main__':
	A=[1,1]
	B=[0,-1]
	C=[-1,0]

	vibes.beginDrawing()
	vibes.newFigure('TestCase1')
	vibes.setFigureProperties({'x': 0, 'y': 0,'width': 500, 'height': 500})
	vibes.axisLimits(-25, 25, -25, 25)
	t,dt,Field,inc,dif,x,y,xmp,ymp,xm,ym = loadData("rot1.pckl")
	t,dt,Field,inc,dif,x2,y2,xmp,ymp,xm,ym = loadData("rot2.pckl")
	time.sleep(15)
	for i in range(len(t)):

		vibes.drawCircle(x[i], y[i], 1, 'black[green]')
		vibes.drawCircle(x2[i], y2[i], 1, 'black[red]')
		vibes.drawCircle(xm, ym, 0.4, 'black[blue]')
		vibes.drawArrow([20, 15], [15, 15], 1, 'black[black]')
		vibes.drawArrow([20, 10], [15, 10], 1, 'black[black]')
		vibes.drawArrow([20, 5], [15, 5], 1, 'black[black]')
		vibes.drawArrow([20, 0], [15, 0], 1, 'black[black]')
		vibes.drawArrow([20, -5], [15, -5], 1, 'black[black]')
		time.sleep(0.001)
		vibes.clearFigure()
Esempio n. 4
0
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 :
#			-	a binary image in uint64 format.
Esempio n. 5
0
        phi.set(interval, Interval(0, h / 2))
        out.append(integrate_box(phi, v, theta, h / 2))

    return union(out), out


if __name__ == "__main__":
    h = 1 / 20
    phi = Interval(-np.pi / 2, np.pi / 2)

    alpha = 0.01
    deltat = 300

    vibes.beginDrawing()
    vibes.newFigure("MagMap")
    vibes.setFigureProperties({
        "x": 200,
        "y": 200,
        "width": 600,
        "height": 600
    })
    vibes.axisLimits(-h, deltat * h, -np.pi / 2, np.pi / 2)

    for k in range(deltat):
        v = Interval(1.0)
        theta = Interval(0.4 * np.sin(k / 20))
        I, out = integrate(phi, alpha, v, theta, h)
        lb, ub = I.lb(), I.ub()
        vibes.drawBox(k * h, (k + 1) * h, lb, ub, "darkCyan[darkCyan]")
        phi = Interval(lb, ub)
Esempio n. 6
0
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)