We have written a code for edge detection in OpenCV java where the background for the image would be plain white to increase accuracy. We have added the following functions for the edge detection part:
Imgproc.GaussianBlur(im, im2, new Size(0,0), 10);
Core.addWeighted(im, 1.5, im2, 0.5, 0.2, im);
Imgproc.Canny(im, edges, 20, 100);
However, there is some problem in the edge detection as even other points in the background appear as edges which affect the code. Can somebody please tell me some improvements so as to get a more accurate output keeping in mind that image would be taken from a smartphone camera as it is the premise of my project.