mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #26698 from warped-rudi:mediandk2
AndroidMediaNdkVideoWriter pixel format enhancement #26698 * videoio(Android): Add source pixel formats RGBA and GRAY to AndroidMediaNdkVideoWriter Let AndroidMediaNdkVideoWriter::write() deduce source pixel format from matrix type: CV_8UC3 -> BGR (as before) CV_8UC4 -> RGBA (use in conjunction with CvCameraViewFrame) CV_8UC1 -> GRAY * samples/android/video-recorder: Send images to VideoWriter in RGBA format ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
+3
-4
@@ -164,16 +164,15 @@ public class RecorderActivity extends CameraActivity implements CvCameraViewList
|
||||
{
|
||||
Log.d(TAG, "Camera frame arrived");
|
||||
|
||||
Mat rgbMat = inputFrame.rgba();
|
||||
mVideoFrame = inputFrame.rgba();
|
||||
|
||||
Log.d(TAG, "Size: " + rgbMat.width() + "x" + rgbMat.height());
|
||||
Log.d(TAG, "Size: " + mVideoFrame.width() + "x" + mVideoFrame.height());
|
||||
|
||||
if (mVideoWriter != null && mVideoWriter.isOpened()) {
|
||||
Imgproc.cvtColor(rgbMat, mVideoFrame, Imgproc.COLOR_RGBA2BGR);
|
||||
mVideoWriter.write(mVideoFrame);
|
||||
}
|
||||
|
||||
return rgbMat;
|
||||
return mVideoFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user