# Cable angle measurement (rotation)

I need to detect the rotation of a cable (degree) in the x-axis with high precision [0.2 (or more) degree detection] from its original state.

Detailed description:

1. I have a cable that is set in its original state.
2. The system has rotated the cable in the x-axis.
3. I want to know the degree the cable has been rotated from its original state.

Example:

There're following images for a specific cable in different rotation (angle) [0, 0.4, 0.6, 0.8]:

1) 2) 3) 4)

[First image shows the initial state of the cable; the following three images show 0.4, 0.6, 0.8 rotation from its initial state respectively)].

Important facts:

• It is not possible to make pictures in better resolution.
• It is not possible to make pictures in better contrast.
• The cables may vary (different positions of the light strips on the cable).

Can this problem be solved using computer vision, neural networks, or other methods/techniques?

• Welcome to DS SE! Would you please add some context about the images and highlight the differences between them (if there are differences the human eye can see)? It's hard to tell what we are looking at.
– Ben
Commented Jul 17, 2020 at 16:59
• @BenjiAlbert Pictures represent cable. All cables have bright stripes as in the pictures above. No, there is no difference that the human eye can see if we rotate it at small angles (eg 0.2). [This is only visible if we rotate it at large angles (eg 30), in which case the bright stripes will be in a different position]." Commented Jul 20, 2020 at 7:08
• is this system going to run continuously to monitor the cables? Is the ultimate objective to reverse the rotation back to 0 degrees? And lastly, would this system be implemented for existing cables where the rotation angle is unknown and incalculable? Or would it only be applied to new cables where the angle is starting at 0? If it is this latter case, I can try to post a simple solution
– Ben
Commented Jul 20, 2020 at 11:18
• @BenjiAlbert Yes, the system is going to run continuously. To be more precise, we put a new cable (and this position is considered as 0 degrees). Then we start to rotate the cable, and the system must determine how much we rotated it. There will be new cables all the time. We don't need to reverse the rotation back to 0 degrees. Commented Jul 21, 2020 at 8:48

Since the difference can't be seen by the human eye, you may need to try teaching an algorithm the difference.

You might try two approaches:

• Train 1 model per cable defining the initial state implicitly

• Train a model with a triplet loss to define an anchor in the initial state.

## Observation:

I strongly recommend to keep the images as raw files or use compression without loss for this kind of image treatment as that will avoid adding artifacts that will reduce your precision. If your data acquisition system cannot sustain the load of transferring raw image files, I would recommend using PNG or jpeg2000(used by NASA to compress images, way more efficient and the transformation used as base is used as inspiration for multiple object detection algorithms)

• Cable is rotated about the x-axis. Hence, the width of the cable is always the same and the height of the cable compared to the frame is also always the same. 1) Doesn't it work in this way that we can learn the model on any other image dataset (using eg. GAN) and remember the weights. And upscale the needed images using pretrained weights? Or do you mean the dataset for predicting the value (angle) (for regression problem as it was mentioned below)? @PedroHenriqueMonforte Commented Jul 20, 2020 at 8:50
• 1) Didn't understand most of the second part for the 1st answer. It means that in the best scenario (but unlikely) it's possible to measure about 0.33 angle and greater, right? 2) It is not a problem to distinguish the cable from the background, but because we rotate the cable with respect to the x-axis, it is necessary to distinguish the slightly lighter stripes in relation to this cable (in my opinion). @PedroHenriqueMonforte Commented Jul 20, 2020 at 8:52
• You mean the cable is rotated in the x axis not the z axis(that points outside the display)? If that is the case, highlight that in you question, I will make the proper editions to this answer, you may ignore all consideration's about method, only image compression may still be relevant right now, after lunch I will edit it) Commented Jul 20, 2020 at 15:01
• By the way, is this optical fiber cable? Commented Jul 20, 2020 at 15:05
• Yes, cable is rotated in the x-axis (the cable is visible all the time on the display). Unfortunately the pictures are taken only in .jpg format (like at the pictures above) and another compression format can't be chosen. 1)What exactly do you mean saying 'Train 1 model per cable'? 2) If i understand you right it means to calculate the triplet loss (eg for 2 pictures) and predict the exact angle of rotation knowing this loss? But we need to train the network (using dataset) to know which losses correspond to which angle. (or to set this range manually?) @PedroHenriqueMonforte Commented Jul 21, 2020 at 12:40