Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have a similar issue I believe and I don't know why it doesn't work. Using OpenCV 3.0. I tried the following:

Mat thresholdBW = new Mat(original.rows(),original.cols(), CvType.CV_8UC1);
Core.inRange(hsv, new Scalar(0, 0, 0), new Scalar(360, 70, 70), thresholdBW);

Mat thresholdBLUE = new Mat(original.rows(),original.cols(), CvType.CV_8UC1);
Core.inRange(hsv, new Scalar(90, 90, 90), new Scalar(130, 255, 255), thresholdBLUE);

Mat threshold = new Mat(original.rows(),original.cols(), CvType.CV_8UC1);
Core.add(thresholdBW, thresholdBLUE, threshold);

thresholdBLUE and thresholdBW have what I want but then after the Core.add call, threshold is just empty. Is there something I am missing?

I have a similar issue I believe and I don't know why it doesn't work. Using OpenCV 3.0. I tried the following:

Mat thresholdBW = new Mat(original.rows(),original.cols(), CvType.CV_8UC1);
Core.inRange(hsv, new Scalar(0, 0, 0), new Scalar(360, 70, 70), thresholdBW);

Mat thresholdBLUE = new Mat(original.rows(),original.cols(), CvType.CV_8UC1);
Core.inRange(hsv, new Scalar(90, 90, 90), new Scalar(130, 255, 255), thresholdBLUE);

Mat threshold = new Mat(original.rows(),original.cols(), CvType.CV_8UC1);
Core.add(thresholdBW, thresholdBLUE, threshold);

thresholdBLUE and thresholdBW have what I want but then after the Core.add call, threshold is just empty. Is there something I am missing?

I found a way to get the result I want by using addWeighted:

Core.addWeighted(thresholdBW, 1, thresholdBLUE, 1, 0, threshold);

But I don't know why Core.add doesn't work.