// Loop over each column
for j in range(0, ncols):
// Initialize a binary image of the circle
bin_img = np.zeros((height, width), dtype=np.uint8)
// The upper left corner is the x starting coordinate + the ROI offset * the
// horizontal spacing between chips
x = coord[0] + j * spacing[0]
// Create a chip ROI
After Change
roi_contour = []
roi_hierarchy = []
// Grid of ROIs
if (type(coord) == tuple) and ((nrows and ncols) is not None) and (type(spacing) == tuple):
// Loop over each row
for i in range(0, nrows):
// The upper left corner is the y starting coordinate + the ROI offset * the vertical spacing