Ask Your Question
0

How to apply mask to live camera in android opencv

asked 2017-09-03 18:27:31 -0600

Quzal gravatar image

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; }

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-09-03 22:01:43 -0600

Ziri gravatar image

You can use : copyTo function.

inputMat.copyTo(outputMat, maskMat);
edit flag offensive delete link more

Comments

Fixed it , Just added tempImg.release() befre bitwise_and

Quzal gravatar imageQuzal ( 2017-09-03 23:37:14 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-09-03 18:27:31 -0600

Seen: 1,203 times

Last updated: Sep 03 '17