|
|
|
@ -159,7 +159,7 @@ public class ColorBlobDetectionActivity extends CameraActivity implements OnTouc |
|
|
|
|
for (int i = 0; i < mBlobColorHsv.val.length; i++) |
|
|
|
|
mBlobColorHsv.val[i] /= pointCount; |
|
|
|
|
|
|
|
|
|
mBlobColorRgba = converScalarHsv2Rgba(mBlobColorHsv); |
|
|
|
|
mBlobColorRgba = convertScalarHsv2Rgba(mBlobColorHsv); |
|
|
|
|
|
|
|
|
|
Log.i(TAG, "Touched rgba color: (" + mBlobColorRgba.val[0] + ", " + mBlobColorRgba.val[1] + |
|
|
|
|
", " + mBlobColorRgba.val[2] + ", " + mBlobColorRgba.val[3] + ")"); |
|
|
|
@ -182,7 +182,7 @@ public class ColorBlobDetectionActivity extends CameraActivity implements OnTouc |
|
|
|
|
if (mIsColorSelected) { |
|
|
|
|
mDetector.process(mRgba); |
|
|
|
|
List<MatOfPoint> contours = mDetector.getContours(); |
|
|
|
|
Log.e(TAG, "Contours count: " + contours.size()); |
|
|
|
|
Log.i(TAG, "Contours count: " + contours.size()); |
|
|
|
|
Imgproc.drawContours(mRgba, contours, -1, CONTOUR_COLOR); |
|
|
|
|
|
|
|
|
|
Mat colorLabel = mRgba.submat(4, 68, 4, 68); |
|
|
|
@ -195,7 +195,7 @@ public class ColorBlobDetectionActivity extends CameraActivity implements OnTouc |
|
|
|
|
return mRgba; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Scalar converScalarHsv2Rgba(Scalar hsvColor) { |
|
|
|
|
private Scalar convertScalarHsv2Rgba(Scalar hsvColor) { |
|
|
|
|
Mat pointMatRgba = new Mat(); |
|
|
|
|
Mat pointMatHsv = new Mat(1, 1, CvType.CV_8UC3, hsvColor); |
|
|
|
|
Imgproc.cvtColor(pointMatHsv, pointMatRgba, Imgproc.COLOR_HSV2RGB_FULL, 4); |
|
|
|
|