Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to apply mask to live camera in android opencv

I'm detecting blue color from live camera feed by using Core.inRange after getting the mask i.e imgThresholded when I take bitwise_and it shows the overlaping frames ,How can I get only one frame ? My App showing all the previous frames in which blue color is detected Here is my Code :

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {       

 Imgproc.cvtColor(inputFrame.rgba(),imgHSV,Imgproc.COLOR_RGB2HSV);
      Core.inRange(imgHSV,new Scalar(100, 100, 100), new Scalar(120, 255, 
      255),imgThresholded); // Blue Color

Core.bitwise_and(inputFrame.rgba(),inputFrame.rgba(),tempImg,imgThresholded); return tempImg; }