1 | initial version |
You can compute the mean pixel value in the entire image and then, compute the mean of a small window (say 5x5) at an arbitrary point. A pixel value between those two means will give you a threshold that can be applied to extract the object.
This will work pretty well if you know whether the object is brighter or darker than the background. If you do not have that information, you can still find it but will need more work.