움직임 감지기를 쓰고 있습니다. 프레임의 특정 영역에서 동작을 감지 할 수 있습니다. 이제는 그 영역을 투명한 색으로 강조하고 싶습니다.미리보기에서 오버레이 투명 색상
Android 용 OpenCV를 사용하고 있습니다.
다른 언어 (예 : this)를 사용하는 다른 자습서를 발견했습니다.
두 이미지를 혼합하기 위해 addWeighted()를 사용합니다.
지금은 미리보기 프레임을 오버레이하려고합니다.
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame {
mRgba = inputframe.rgba();
//defined a Mat that overlays the frame:
Mat greenOverlay = mRgba.submat(0, mRgba.height(), 0, mRgba.width()/5)
mGreenOverlay.setTo(GREEN);
Core.addWeighted(mGreenOverlay,0.5,mRgba,0.5, 0.0, mRgba);
return mRgba;
}
문제는 (로그 캣이 표시) greenOverlay 및 inputFrame 같은 크기를 필요가 없다는 것입니다 : 나는 다음과 같은 코드를 시도했다. 로그 캣 메시지 :
OpenCV Error: Sizes of input arguments do not match
(The operation is neither 'array op array'
(where arrays have the same size and the same number of channels),
nor 'array op scalar', nor 'scalar op array')
가 어떻게이 문제를 해결할 수
?솔루션
TORIS의 대답은 작동합니다. (파이썬으로 작성) 튜토리얼에서
Mat greenOverlay = mRgba.clone();
Imgproc.rectangle(greenOverlay, new Point(0, 0), new
Point(mRgba.width()/5, mRgba.height()), GREEN, -1);
Core.addWeighted(greenOverlay,0.25,mRgba,0.75, 0.0, mRgba);