Notifications
Clear all

[Closed] curvecontrol help

Are there any example scripts or additional documentation for curvecontrol? Am trying to input values from listview to curvecontrol. Here is example of function from script I have so far:


fn update_CurveControl =
(


	global temp1_CamMod = #()
	global temp2_CamMod = #()
	global txt_stuff = ""
	
	global CurrentCurve1_temp1 = #()

	global txt_count = CamDistort_main.CamDistort_CamMod_List.Items.count

		for i = 0 to txt_count-1 do
		(

			txt_Focal = CamDistort_CamMod_List.Items.item[i].SubItems.Item[0].text as string
			txt_a = CamDistort_CamMod_List.Items.item[i].SubItems.Item[1].text as string
			txt_b = CamDistort_CamMod_List.Items.item[i].SubItems.Item[2].text as string
			txt_c = CamDistort_CamMod_List.Items.item[i].SubItems.Item[3].text as string
			txt_CenterX = CamDistort_CamMod_List.Items.item[i].SubItems.Item[4].text as string
			txt_CenterY = CamDistort_CamMod_List.Items.item[i].SubItems.Item[5].text as string


			global txt_stuff  = txt_Focal + ";" + txt_a + ";" + txt_b + ";" + txt_c + ";" + txt_CenterX + ";" +txt_CenterY

			theSeL = txt_stuff   
			temp2_CamMod = append temp1_CamMod (txt_stuff as string)
								

		)

				global CurrentCurve1 = cc_test.curves[1]
				global CurrentCurve2 = cc_test.curves[2]
				global CurrentCurve3 = cc_test.curves[3]
				global CurrentCurve4 = cc_test.curves[4]
				global CurrentCurve5 = cc_test.curves[5]
			   
				
				CurrentCurve1.name = "a"
				CurrentCurve2.name = "b"
				CurrentCurve3.name = "c"
				CurrentCurve4.name = "CenterX"
				CurrentCurve5.name = "CenterY"				
				
				CurrentCurve1.color = red
				CurrentCurve2.color = green
				CurrentCurve3.color = blue
				CurrentCurve4.color = orange
				CurrentCurve5.color = brown
				
				
				CurrentCurve1.numPoints = temp2_CamMod.count -- + 1
				CurrentCurve2.numPoints = temp2_CamMod.count -- + 1
				CurrentCurve3.numPoints = temp2_CamMod.count -- + 1
				CurrentCurve4.numPoints = temp2_CamMod.count -- + 1
				CurrentCurve5.numPoints = temp2_CamMod.count -- + 1
 
			For j = 1 to temp2_CamMod.count do
			(
			
				global txt2_array = filterstring temp2_CamMod[j] ";"
		

				cc_test.x_range = [CamDistort_spinner_FLoriginal.range.x, CamDistort_spinner_FLoriginal.range.y  ]
	 
			
				CurrentCurve1.points[j].value = [(txt2_array[1] as float),(txt2_array[2] as float)]
				CurrentCurve2.points[j].value = [(txt2_array[1] as float),(txt2_array[3] as float)]
				CurrentCurve3.points[j].value = [(txt2_array[1] as float),(txt2_array[4] as float)]
				CurrentCurve4.points[j].value = [(txt2_array[1] as float),(txt2_array[5] as float)]
				CurrentCurve5.points[j].value = [(txt2_array[1] as float),(txt2_array[6] as float)]

				CurrentCurvePoint1 = CurrentCurve1.points[j]
				CurrentCurvePoint2 = CurrentCurve2.points[j]
				CurrentCurvePoint3 = CurrentCurve3.points[j]
				CurrentCurvePoint4 = CurrentCurve4.points[j]
				CurrentCurvePoint5 = CurrentCurve5.points[j]

				
				append CurrentCurve1_temp1 (CurrentCurve1.points[j].value as string)

				
			)
			
   
zoom cc_test #all



)



With code; I’ve tried adding additoinal two points to be added to numpoints (one at start and another at end). THat didnt work or may work later I’m not sure. Results are often overlaping points which give appearance that say 2 of 5 points are missing but are overlaping on some point instead.

In case anyone is wondering what I’m doing is similar to this – http://pagesperso-orange.fr/dpont/plugins/RadialShift_Camera.html . Basically allows for camera radial distortion using Hugin and Fulla ( http://hugin.sourceforge.net/ ). Have been testing with checkerboard script from Asylum. Looking great so far but also has a batch convertor for converting animations, images, avi’s, etc to new distorted or undistorted parameter.

Tried equations available for radial distortion but cant get them to work well with getpixels and setpixels formating in mascript. May return to that in future once these next few features are complete. So far I’m simply calling it CamDistort.

Any help regarding this would be greatly appreciated.

Mark

1 Reply

Think I found part of the problem. Didn’t realize that value both ‘points’ and ‘value’ were both read only which would make it impossible to add values to. Have been trying to use ‘setpoint’ instead without much luck. Am having trouble with getting formatting correct.

CurrentCurve1 = cc_test.curves[1]
getpoint CurrentCurve1 1

returns “#CCPoint(@[0.000999588,0])”

setpoint CurrentCurve1 1 #CCPoint(@[10,0])
– Syntax error: at bad, expected <factor>
– In line: setpoint CurrentCurve1 1 #CCPoint(@[