For the edge detection problem of wall-mounted cleaning robots for window frame obstacles, based on the original canny operator, this paper proposes an algorithm based on improved canny obstacle edge detection. In order to suppress noise and extract image edge details, the improved canny operator increases the gradient template of 45° and 135°; for the traditional canny operator to set the limits of high and low thresholds, use the iterative method to find the best high and low thresholds. . Finally, through the MATLAB simulation, compared with the traditional canny edge detection algorithm, the improved canny operator has achieved good results in the edge detection of window frames.