opencvsubpixel

find4QuadCornerSubpix vs cornerSubPix


I'm not able to find any kind of information about the find4QuadCornerSubpix() function. I'm trying to understand the differenti between find4QuadCornerSubpix() and cornerSubPix().

Someone can help me?

thanks


Solution

  • TLDR; use cornerSubPix, find4QuadCornerSubpix is unfinished

    I tested both corner refinements with artificial generated images (low noise added, no distortions, most quads around ~ 100pxl edge length) with these abs. differences measured in pixel:

    1. rms 0.0537 max 0.1963; cv::findChessboardCorners (no additional ref.):
    2. rms 0.0368 max 0.0969; (1) + 11x11 cornerSubPix; same param as in ocv tutorial
    3. rms 0.2230 max 1.2619; (1) + 11x11 find4QuadCornerSubpix (imgs binarized w. adaptive Thr.)

    I tested 3x3, 11x11, 50x50, 100x100, 150x150 and inputing images binarized w. adaptive Thr.; all with the same result.

    I chose some real-world examples where the intrinsic calibrations have an reprojection rms of about 0.08 for something similar to (2). For (3) they had 0.25 pixel reproj. rms.

    So currently (opencv release 4.5.1) to me the find4QuadCornerSubpix looks unfinished and unusable. A rms of 0.5 is the maximum error I would expect without any subpixel refinements. The function also fails if any input coordinate is closer to the image border than region_size/2

    Sources: https://github.com/opencv/opencv/blob/fc1a15626226609babd128e043cf7c4e32f567ca/modules/imgproc/src/cornersubpix.cpp https://github.com/opencv/opencv/blob/fc1a15626226609babd128e043cf7c4e32f567ca/modules/calib3d/src/quadsubpix.cpp https://github.com/opencv/opencv/blob/b450dd7a87bc69997a8417d94bdfb87427a9fe62/modules/calib3d/src/calibinit.cpp https://github.com/opencv/opencv/blob/b19f8603843ac63274379c9e36331db6d4917001/samples/cpp/tutorial_code/calib3d/camera_calibration/camera_calibration.cpp