Hi @Chorongiee!
This image work pretty good in my code & it is correctly detecting your required border. Check your Canny image output it seems like it is containing some white pixels in the outer border. other than that it looks good.
If you want some other better approach try this.
- Load BGR image & convert it into HSV Image.
- Now filter the black regions by filtering the HSV Range V- 100 to 255. The result will look like this.
- Apply Gaussian smooth & threshold binary so smooth the edges if you want.
- Find contours with RETR_TYPE.CV_RETR_EXTERNAL to find only the outer most contours.
- Result is your required output image.