DIP+CV · Interactive Simulator

Interactive simulator of the QRCode isolation pipeline : navigate through the...

📱 Simulator EP06: QRCode Isolation Threshold → Closing → Contour · Synthetic Template
Select the step:
Original
Final crop (QRCode)
🧠 Pipeline steps (faithful replica of the reference OpenCV algorithm)
1
Thresholding (mm.threshold): Segments the dark QRCode modules, isolating them from the light background.
2
Morphological closing (mm.close + mm.sebox(k)): dilation followed by erosion removes noise and fills discontinuities. sebox(0) = 3×3 kernel, sebox(1) = 5×5, and so on. Note that closing is used here (≠ the opening used in the code cell above), which encourages comparison between the two operators.
4
Contour detection (cv2.findContours, RETR_EXTERNAL): Finds the largest external contour with an approximately square proportion (width/height ratio between 0.7 and 1.3), discarding elongated rectangles from the sheet.
5
Crop + safety margin: Extracts the bounding box of the selected contour, with a 5px margin, from the original grayscale image.
Description: Figure 6.11: Interactive simulator of the QRCode isolation pipeline : navigate through the filtering steps, adjust the structuring element of the morphological closing, and see the square contour detection on the original template image.