I am getting a random crash with connectedComponentsWithStats.
This is what I'm doing in a nutshell: 1 - Capturing from video feed and converting to HSV 2 - Looking for certain HSV ranges within the image, and then masking out the rest. 3 - Using connectedComponentsWithStats to get blobs from the image and analyze them (to weed out the noise).
But sometimes connectedComponentsWithStats works fine and then occasionally it just crashes.
Here's a snippet of my code.
Mat labelsYAxis, statsYAxis, centroidsYAxis;
Mat labelsXAxis, statsXAxis, centroidsXAxis;
Mat labelsBase, statsBase, centroidsBase;
int nYAxisLabels = connectedComponentsWithStats(yAxisBlobs, labelsYAxis, statsYAxis, centroidsYAxis, 8, CV_32S);
int nXAxisLabels = connectedComponentsWithStats(xAxisBlobs, labelsXAxis, statsXAxis, centroidsXAxis, 8, CV_32S);
int nBaseLabels = connectedComponentsWithStats(baseBlobs, labelsBase, statsBase, centroidsBase, 8, CV_32S);