Ask Your Question
0

findCirclesGrid ordering incorrect?

asked 2017-07-17 09:46:21 -0600

updated 2017-07-19 11:30:31 -0600

When using findCirclesGrid in python it seems that the ordering of the found circles is inverted. My found circles are currently ordered:

  • row wise: bottom to top
  • column wise: right to left

According to the documentation (at least how I interpret it) I expected it to be the other way around:

  • row wise: top to bottom
  • column wise: left to right

Several months ago I used this function in c++ and it seemed to behave in the manner as I expected (top to bottom, left to right).

Am I doing something wrong / interpreting the documentation incorrectly or is this a bug that should be reported?

Below a minimal working example which works on the attached bitmap.

edit: image did not get attached. Posted the image here http://imgur.com/a/ROVss Minimal working example:

#!/usr/bin/python
import cv2
import numpy as np
img = cv2.imread('circ_min.bmp', 0)
shape = (5, 8)
blobPar = cv2.SimpleBlobDetector_Params()
blobPar.minArea = 1e4
blobPar.maxArea = 1e5
blobPar.minDistBetweenBlobs = 200
blobDet = cv2.SimpleBlobDetector_create(blobPar)
[found, cc] = cv2.findCirclesGrid(img, 
    shape,
    None,
    flags=cv2.CALIB_CB_SYMMETRIC_GRID+cv2.CALIB_CB_CLUSTERING,
    blobDetector=blobDet)

cv2.namedWindow('src', cv2.WINDOW_NORMAL)
img = cv2.cvtColor(img, cv2.COLOR_GRAY2BGR)
if found:
    print(cc)
    for i in cc:
        cv2.circle(img, tuple(i[0]), 10, (0, 0, 255), -1)
        cv2.imshow('src', img)
        cv2.waitKey(0)

Details about my setup: - Arch Linux: Linux archy 4.11.9-1-ARCH #1 SMP PREEMPT Wed Jul 5 18:23:08 CEST 2017 x86_64 GNU/Linux - Linux (guest) is running in virtualbox: 5.1.22 (Windows 10 host) - Opencv 3.2.0 - using Python 3.6.1 (default, Mar 27 2017, 00:27:06) [GCC 6.3.1 20170306] on linux

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-07-19 10:37:42 -0600

This also occurs when using the findCirclesGrid from c++.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-17 09:43:26 -0600

Seen: 812 times

Last updated: Jul 19 '17