public ContourPacked copy() { ContourPacked ret = new ContourPacked(); ret.id = id; ret.externalIndex = externalIndex; ret.internalIndexes = internalIndexes.copy(); return ret; } }
/** * Step 1: If the pixel is unlabeled and the pixel above is not one, then it * must be an external contour of a newly encountered blob. */ private void handleStep1() { ContourPacked c = contours.grow(); c.reset(); c.id = contours.size(); tracer.setMaxContourSize(maxContourSize); // save the set index for this contour and declare memory for it c.externalIndex = packedPoints.size(); packedPoints.grow(); c.internalIndexes.reset(); tracer.trace(contours.size(),x,y,true); // Keep track that this was a contour, but free up all the points used in defining it if( packedPoints.sizeOfTail() >= maxContourSize || packedPoints.sizeOfTail() < minContourSize ) { packedPoints.removeTail(); packedPoints.grow(); } }