measuring an object length in an image


So I want to determine the length of an opening in an image and the image also has a reference opening in it that I know the measurement of. Does anyone know who to do this in R? The only thing I have found are some blog posts using Python and OpenCV but the object of interest and the reference images are two demensional where mine are really one. Sorry this is so non descriptive and there is no code but I am not really sure where to start.

Here is the blog post for Python/OpenCV for 2D measurements with a 2D reference