Update:
median blur did not help much so I traced the cause and found that the page boundary was detected in bits and pieces and not a single contour so it detected the biggest contour as a part of the page boundary
Therefore performed some morphological operations to close relatively small gaps and the resultant largest contour is definitely improved but its its not optimum. Any ideas how I can improve the big gaps?

Comments

this is not an easy task because of the high variability of the background. Instead of the gaussian blur you can try a median filter with a big kernel (is much mir stronger than gaussian) of your can try an edge detection method based on image pyramid which enhances strong long edges but ignores short and weak ones
an example image would be helpful

Can you shed some light on how can I do "edge detection method based on image pyramid which enhances strong long edges but ignores short and weak ones?"
I've added sample images. 1 with correct corner detection because of the obvious contrasting background and the other with a bit of similar background where largest contour in the image was wrongly detected.

Comments

Well I tried HoughLines but I am not getting the same result as your result images. I am implementing this in java and am getting over 2000 lines if the threshold is 80 which by the way does include the page boundaries. Any help implementing this would be greatly appreciated

I am aware of that. I also know that the lines are arranged in decreasing order according to the number of votes. But even if I set a high threshold value of 200, it returns 14 lines, none of which actually belonging to the page boundary. This is where I am stuck

I have no experiences using OpenCV in Java. In the end, if you have a good binarized image with edges of your interest you only have to find suitable parameter for Hough Transformation, which should not be that challange

Beautiful. Those images helped a ton!!
I have found my error. When I use canny using the same setting as yours, my contour is not continuous as yours. I wonder why? Any idea?
Can I ask another favour? Can you perform show these intermediate photos for another sample picture? I updated the url for it in the question. Thanks a lot in advance

if the background is at least not slightly different from the foreground it is a hard job and would take much more effort to solve. Therefore give attention that the background is slightly different and if you acquire the image that you have enough light to strengthen the image quality (increase contrast and decrease noise)

agreed! it's almost impossible to work with the 3rd Image. I don't get your homework reference. Anyways, I'm just one step away from solving this. I just can't figure out why isn't canny detecting the edges after the adaptive threshold has clear boundaries. Do you have any suggestions?