I'm trying to write an OpenCV program in Java that takes a photo of a marker with a phone and finds circular contours on the marker. I have gotten it working in the Android emulator (where the photo has perfect lighting conditions), but can't get it to work with the phone itself.
This is the marker I'm trying to capture:

[![enter image description here](https://i.stack.imgur.com/Ks2NJ.jpg)](https://i.stack.imgur.com/Ks2NJ.jpg)

After using the combination of transforming to grayscale, a Gaussian blur and a Canny edge detector, I get this output:

[![enter image description here](https://i.stack.imgur.com/N6pDO.jpg)](https://i.stack.imgur.com/N6pDO.jpg)

If I then try to find the contours on the image, the number of contours returned is really high (over 1000), but they aren't closed (because the edges seem to be too weak.
The contours drawn over the original image:

[![enter image description here](https://i.stack.imgur.com/fIPtx.jpg)](https://i.stack.imgur.com/fIPtx.jpg)

This is the code I use for the segmentation:

```
Mat processed = new Mat(original.height(), original.width(), original.type());

Imgproc.cvtColor(original, processed, Imgproc.COLOR_RGB2GRAY);

Imgproc.GaussianBlur(processed, processed, new Size(7, 7), 0.1);

Imgproc.Canny(processed, processed,  50, 50*3, 3, false);

```

I have tried tweaking the different parameters (thresholds etc.), but feel like that isn't the ideal solution. I'm thinking there has to be a way to enhance the edges returned by the canny detector, but I haven't found anything myself.

Any help is appreciated!