[Python] How to find the four corner coordinates of a black quadrilateral using OpenCV?

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    enter image description here

    I want to find the corner coordinates of the two black quadrilaterals in the image.

    It can be implemented in python or C++

    My current method is based on “deep learning + OpenCV”, with the following pipeline:

    NV12 frame input

    (1)(NanoDet object detection model) → detection → confidence filtering → (x1, y1, x2, y2) … → sorting → [ROIs]

    (2)(OpenCV) For each ROI: Gray enhancement→ Gaussian blur → Binarization → Morphological closing → findContours → take the largest contour → approxPolyDP (ε = 0.02 * perimeter) → keep only 4 points → cornerSubPix (sub-pixel refinement, suggested on gray ROI) → corner point sorting / rotation alignment → map back to full-image coordinates → save the 4 corner points of this ROI

    Return: the set of quadrilateral corner points for all ROIs (square_results).

    However, the actual performance is poor. How should I improve it?

    Continue reading...

Compartilhe esta Página