android - Hot to convert a Mat object to byte[] data object in "onPreviewFrame" and show it in camera preview -


in android app, trying take frames in "onpreviewframe" , convert them mat object can on them image processing, don't know how convert them byte[] type , make them shown on camera preview.

does 1 know how that?

here onpreviewframe function, trying change frame color grey:

public void onpreviewframe(byte[] data, camera arg1) {     mat mrgba = new mat(previewsizewidth, previewsizeheight, cvtype.cv_8uc3);     mrgba.put(0, 0, data);      imgproc.cvtcolor(mrgba, mrgba, imgproc.color_bgr2gray);     mrgba.put(0, 0, data);      mcamera.addcallbackbuffer(data);  } 

thanks in advance!

from older implementation of opencv camera viewer pipeline:

private mat myuv, mgraysubmat;  @override public void onpreviewframe(byte[] data, camera camera) {     if(myuv == null) {         myuv = new mat(height + height / 2, width, cvtype.cv_8uc1);         mgraysubmat = myuv.submat(0, height, 0, width);     }     myuv.put(0, 0, data);     imgproc.cvtcolor(mgraysubmat, mrgba, imgproc.color_gray2rgba, 4); } 

i think can call addcallbackbuffer method in end , it'd work fine!


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -