The OP may be interested in how some pipe manufacturers measure their products in the production line. Here's one method, by Starrett (a well-known name in measurement technology)
I wouldn't be surprised if this unit costs US$50,000 or more, not including installation and training.
Something similar could probably be done at a hobby level with an RPi, but it would be quite a challenge.

Some quotes:
"...the measurement work envelope is from a minimum diameter of 125mm (5”) to a maximum diameter of 600mm (24”)...."
"...accuracy is 0.15mm on the diameter and is verified by checking a metrology lab-certified gauge block with known dimensions..."
"...sensors are mounted at four positions 90 degrees apart..."
"...each sensor projects a laser line across the pipe diameter. A camera in the sensor takes a snapshot of the laser line at 45 degree angle. This exposes the laser line
as an arc. The CCD array in the camera digitizes the arc into 1,600 columns of
pixels. Each column has 1,200 pixels...."
"...software converts the pixel data into spatial x-y coordinates....the coordinates from 4 sensors are combined into a single data set using a patented registration algorithm. The resulting point cloud is analyzed using mathematical tools that calculate various measurement parameters for each cross section...."