transparent addWeighted function on Android 4.4
Hi Seniors
I am trying to make a transparent image over a Mat, I am having android application that is capturing live camera, OpenCV said that addWeighted function can make image transparent, then I have implemented my code for it as below
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
Mat mFrame = inputFrame.rgba(); //read from camera frame
Mat mTransparent = new Mat(150, 200, 1, new Scalar(248, 248, 248)); `*//this is a frame that I want to overlay on mFrame*`
Rect roi = new Rect(150, 200, 40, 60);
Mat nFrame_roi = mFrame.submat(roi);
Core.addWeighted(nFrame_roi, 0.8, mTransparent, 0.2, 1, mFrame);
return mFrame;
}
when test in Android the error occurs "Unfortunately, camera control has stopped"
Could you help me explain why the addWeighted function is not working well on Android? or any wrong in my code?
Thank a alot. Tim.
Hi all,
I found solution for addWeighted function and display overlay Mat but it's not transparent, (opencv3.0.0, android 5.1)
my amendment code is: int count = 0; public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
}
anyone tell me why it's not transparent? thanks Tim.