Point parameters in FCP
Point parameters in FCP
- Subject: Point parameters in FCP
- From: "Hugh Denman" <email@hidden>
- Date: Mon, 15 Oct 2007 00:21:53 +0100
Hi -
my thanks to everyone on this list, especially Paul, Dave, and Micah, for the help with all my issues so far. My plugins are very nearly finished... I just have one more thing to clear up. This has to do with translating point parameters into image space. I find that some strange transformation is necessary to achieve this when the source footage is being scaled to match the timeline.
My present code, which uses two points to identify a region, is shown below. It works perfectly for the 'x' ordinate. However, my 'y' values are slightly off, proportional to the distance from the center of the image. For example, if I add a 720x576 clip with PAL aspect ratio to a 720x480 sequence with NTSC aspect ratio, and click right at the top of the image when selecting my point, I see a Y value of -238 in the UI. I get passed
0.0868 as my 'y1' value from the point. scaleX and scaleY are 1; the pixelAspect is 0.5333 (I'm passed a 720x288 field). This results in a region_topLeft.y value of 25, even though I clicked right at the top of the frame (so I expected 0).
I think that what's going on has to do with the aspectRatio, but I haven't figured out how to use it to get the result I want.
I hope that description is not too opaque; again, any help very gratefully received.
thanks,
Hugh
UInt32 frameWidth = [output imageInfo].width;
UInt32 frameHeight = [output imageInfo].height; //Could be half height, if it's a field
double x1, y1, x2, y2;
[getAPI getXValue:&x1 YValue:&y1 fromParm:kCornerOneID atTime: time]; //time comes from [actionAPI currentTime]
[getAPI getXValue:&x2 YValue:&y2 fromParm:kCornerTwoID atTime: time];
//Deal with scaling (identity xform if scaleX = 1)
x1 = 1 - (0.5 - (x1 - 0.5)*renderInfo.scaleX);
x2 = 1 - (0.5 - (x2 - 0.5)*renderInfo.scaleX
);
y1 = 1 - (0.5 - (y1 - 0.5)*renderInfo.scaleY);
y2 = 1 - (0.5 - (y2 - 0.5)*renderInfo.scaleY);
//Order left / right & top / bottom, & scale up to frame
region_topLeft.x = frameWidth * ( ((x1 < x2) ? x1 : x2) );
region_topLeft.y = frameHeight * ( ((y1 < y2) ? y1 : y2) );
region_botRight.x = frameWidth * ( ((x1 >= x2) ? x1 : x2) );
region_botRight.y = frameHeight * (((y1 >= y2) ? y1 : y2) );
--
email@hidden+353876290136
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden