Here's one technique that should work. First, do a nonlinear calibration for you camera/lens setup to remove any distortion due to perspective and lens abberation. Calibration also allows you to convert measurements in pixels to real world units.
After calibrating your image, use IMAQ Select Line to manually locate the left edge of you part. Calculate the center point of the line to get an accurate x-coordinate.
Then use IMAQ Construct ROI, followed by IMAQ Find Vertical Edge to locate the left edge of your part.
Once you have the coordinates of the two edges in pixels, use IMAQ Convert Pixel to Real World to get these locations in engineering units.
Regards,
Brent Runnels
Applications Engineer
National Instruments