imageproc icon indicating copy to clipboard operation
imageproc copied to clipboard

intersection_points function in hough.rs has bug if intersection point is in image corner.

Open alanthinker opened this issue 1 year ago • 0 comments

need check two point is not a same point.

should be:

    if right_y >= 0.0 && right_y <= h {
        let right_intersect = (w, right_y);
        if let Some(s) = start {
            if right_intersect != s {
                return Some((s, right_intersect));
            }
        }
        start = Some(right_intersect);
    }

    if left_y >= 0.0 && left_y <= h {
        let left_intersect = (0.0, left_y);
        if let Some(s) = start {
            if left_intersect != s {
                return Some((s, left_intersect));
            }
        }
        start = Some(left_intersect);
    }

    if bottom_x >= 0.0 && bottom_x <= w {
        let bottom_intersect = (bottom_x, h);
        if let Some(s) = start {
            if bottom_intersect != s {
                return Some((s, bottom_intersect));
            }
        }
        start = Some(bottom_intersect);
    }

    if top_x >= 0.0 && top_x <= w {
        let top_intersect = (top_x, 0.0);
        if let Some(s) = start {
            if top_intersect != s {
                return Some((s, top_intersect));
            }
        }
    }

alanthinker avatar Jul 01 '23 12:07 alanthinker