Automatic measurement under the microscope

Hello, help with the program. We need an .exe program that will automatically measure a part under a microscope using opencv (i.e.) arithmetic operations with pixels, then display info on the screen
Measurement parameters:

Length, if (long) <3.9mm or >4.1mm print “Marriage is long”

Cone height, if (cone) <0.50mm or >0.55mm print “Cone defect”

Cone angle, if (angle) <50⁰ or > 55⁰ print “Corner Defect”

P.s there is an approximate python code in the construction of contour seams and measurements, but I can’t figure it out