This scripts loads one or more images and creates a split image where each of the images is displayed in a cone of equal angle.
Usage:
dng create_split_image.py <input image 1> [<input image 2> <input image 3> .... ] <output image>
7 def CreateSplitImage(imagelist, start_at_y=True):
8 result=imagelist[0].Copy(
False)
9 result.CenterSpatialOrigin()
10 extent=imagelist[0].GetExtent()
12 startpoint=Vec2(0.0,-extent.GetSize()[0])
14 startpoint=Vec2(extent.GetSize()[0],0.0)
15 angle=2*pi/len(imagelist)
17 for image
in imagelist:
18 image.CenterSpatialOrigin()
19 start_angle=angle*count
20 end_angle=angle*(count+1)
22 pol.AddNode(Vec2(0,0))
23 pol.AddNode(
Rotate(startpoint,start_angle))
24 if(start_angle<pi/4.0
and end_angle>pi/4.0):
25 pol.AddNode(
Rotate(startpoint,pi/4.0))
26 if(start_angle<3.0*pi/4.0
and end_angle>3.0*pi/4.0):
27 pol.AddNode(
Rotate(startpoint,3.0*pi/4.0))
28 if(start_angle<5.0*pi/4.0
and end_angle>5.0*pi/4.0):
29 pol.AddNode(
Rotate(startpoint,5.0*pi/4.0))
30 if(start_angle<7.0*pi/4.0
and end_angle>7.0*pi/4.0):
31 pol.AddNode(
Rotate(startpoint,7.0*pi/4.0))
32 pol.AddNode(
Rotate(startpoint,end_angle))
34 result+=image.Apply(img.alg.MaskImage(m))
39 imagelist=io.LoadImageList([
'circle.png',
'square.png'])
41 imagelist=io.LoadImageList(sys.argv[1:-1])
43 result=CreateSplitImage(imagelist)
44 v_result=gui.CreateDataViewer(result,
"Split Image")