예제 #1
0
def scanone(D,s):
	"""Does one scan by:
	1. Capturing the picture from phone's camera
	2. Detecting the laser curve
	3. Smoothing the curve and returning a pointcloud with Point instances"""
	droid.cameraCapturePicture('/sdcard/foo' + IMAGE_EXTENSION)
	img = Image.open('/sdcard/foo' + IMAGE_EXTENSION)
	img.load()
	r,g,b = img.split()
	del(img)
	r.load()
	r = apply_threshold(r,128)
	points2d = computations.generate_pointcloud(r,255)
	points3d = computations.generate_3d_pointcloud_from_2d(points2d,D,s,r.size[0])
	del(points2d); del(r)
	return points3d
예제 #2
0
def scanmultiple(D,s,n,delete=False):
	images = []
	for i in xrange(0,n):
		droid.cameraCapturePicture('/sdcard/foo{1}{2}'.format(i,IMAGE_EXTENSION))
		images.append(Image.open('/sdcard/foo{1}{2}'.format(i,IMAGE_EXTENSION)))
	
	for img in images:
		img.load()
		r,g,b = img.split()
		del(img)
		r.load()
		r = apply_threshold(r,128)
		points2d = computations.generate_pointcloud(r,255)
		points3d = computations.generate_3d_pointcloud_from_2d(points2d,D,s,r.size[0])
		del(points2d); del(r)
	
	if delete is True:
		for i in range(0,n):
			rm('/sdcard/foo{1}{2}'.format(i,IMAGE_EXTENSION))
			droid.makeToast('Directory is now clean')
			
	
	return points3d