/** * Only converts the specified blobs over into the binary image. Easier to use version of * {@link #labelToBinary(GrayS32, GrayU8, boolean[])}. * * @param labelImage Input image. Not modified. * @param binaryImage Output image. If null a new one will be declared. Modified. * @param numLabels Number of labels in the image. This is the number of found clusters + 1. * @param selected The index of labels which will be marked as 1 in the output binary image. * @return The binary image. */ public static GrayU8 labelToBinary(GrayS32 labelImage , GrayU8 binaryImage , int numLabels, int ...selected ) { boolean selectedBlobs[] = new boolean[numLabels]; for (int i = 0; i < selected.length; i++) { selectedBlobs[selected[i]] = true; } return labelToBinary(labelImage,binaryImage,selectedBlobs); }