I guess it is a microscope output.
First you have to detect (locate) objects in the image :
My default solution would be object detection with machine learning models. This is the way if you have lots of labeled data (e.g annotated image).
For example, you can train a YOLOv3 tiny model for this problem. Without diving into too much code, you can find the tutorial for detecting something different, and apply it to your problem. For example, you can follow this tutorial, then you will ask more specific questions.
If you are familiar with object detection with machine learning and frameworks like PyTorch and TensorFlow, you can find lighter models than YOLOv3 tiny from the GitHub, and you can re-train them.
You can achieve insane accuracies using machine learning, however, there are other methods :
- Other solutions rather than machine learning may be object detection using contour plots or object detection using HSV color space. You can find other Image Processing methods without machine learning on YouTube or other tutorial platforms.
Maybe you can follow these tutorials and then ask more specific code-related questions like "Why is the blurring is not working on my contour plot code?".
Second, after you are able to detect objects, you should extract the bounding box coordinates center, and compare it with the image center coordinates.
If the X coordinate of the detected object bounding box center is greater than the (width of the image)/2, then the object is on the right of the image. If it is smaller, then the detected object is on the left side of the image.
Hope this answers your question.