How can I detect the dark black socket from the dark or very reflective bacground?

1 view (last 30 days)
I need to detect the CCS2 connector of electric cars. It is very dark, with dark and poor textures.
I have some results with intensity transformations using imadjust and gamma correction when I am deparating the connector from the background. Later, I am using morphology.
Still, when I place the camera little far from the connector, 40cm-50cm the image spoils, and the detection fails, specially at daylight. The detection from 20-25cm is 100%.
I am using ZED2i depth camera and diffuse light sources, but the depth image is very poor due to the socket texutes, and now first I need to detect the connector position from the color image.
I would like to use image processing techniques, not deep learning if it is possible (I was thinking about RCNN network, or mask-RCNN, but I can not find the detail description how can I make the training with my own data/images).
I have attached the images too.
Please, any suggestion to improve the detection from 50cm distance (the greater distance would more better).
Naturally, a new camera could help, but the goal is to generate the depth image too, not only the color image.
Thanks!
  2 Comments
L
L on 2 Aug 2022
Hello Mathias,
No, there is no option to crop the image.
The goal is to record the image from about 50cm and detect/extract the connector.
Also, the detection should work with various illumination conditions (daylight, artificial light, etc.)

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 3 Aug 2022
imadjust won't help. Increasing global brightness or contrast will not help with segmentation. Just think about it and you should know why.
Local contrast enhancement like with adapthisteq or imlocalbrighten might help.
If the connectors are of the same type, you might be able to use normalized cross correlation to find them. Demo attached. But it will depend on the template having the same size as the connector, which is unlikely from images collected from the field.
Otherwise if you had hundreds of photos and wanted to label them all with ground truth of known connector pixels, then you could use segnet.
  14 Comments
L
L on 10 Aug 2022
Hello,
This is an update to previous post. I did the adaptive thresholding. The image is attached. The global thresholding is not useful since the enviroment is white.
Now, I am thinking about simple operations to extract the mask of the socket area.
Maybe the combination of the edge image with this can produce a reliable solution (the goal is with any enviroment)?
L
L on 10 Aug 2022
This is the example with a silver (alu-foil) background. The socket is illuminated with the same hand lamp as before, however now the sunlight is affecting the scene from the left side. The results of the adaptive thresholding and the Sobel edge detector are shown in the sample images.
The possible solution is to illuminate the socket in dark. However, is it possible to separate and extract the socket from this kind of input image (to get the mask of the socket)?
Possibly this is one of the worst cases.

Sign in to comment.

More Answers (1)

Mathias Smeets
Mathias Smeets on 3 Aug 2022
I don't know a specific solution.
However, here is a link that might help. I had a similar (easier) problem and I tried out a lot of different things on this link under 'segmentation techniques'.
Another thing you might try is using the functions imadjust (for enhancing contrast) and imlocalbrighten (for brightening) before you do the actual processing.
  4 Comments
L
L on 3 Aug 2022
Edited: L on 3 Aug 2022
I am sending you two good results when the detection is correct, and I am sending you the image after imadjust and few operations. In this example the detection fails. Generally, if there are several white areas with similar dimensions as the connector itself, that is the problem.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!