'find object canny edge detection and remove noise background

Hello i am trying to get this canny edge detection in this

enter image description here but what I achieve is

enter image description here

how to remove noise from the background like the example one and only show the car?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source