Ask Your Question
0

Mat::convertto() not working in javacv, tutorial 2 mixed

asked 2013-07-25 06:36:20 -0600

flankechen gravatar image

I am developing an android opencv apps. Based on Opencv4android SDK tutorial 2- mixed process.

in the frame processing functionpublic Mat onCameraFrame(CvCameraViewFrame inputFrame) {}

since the Frame is RGBA and I want to make RGB by doing show

 mRgba = inputFrame.rgba();
 mGray = inputFrame.gray();

 Mat mRgb=new Mat(640,480,CvType.CV_8UC3);

 mRgba.convertTo(mRgb, CvType.CV_8UC3);

 PinkImage(mRgba.dataAddr());

I debug and log the things I passed to jni part, and I find it's not working at all. mRgb is CV_8UC4 even after the converto();

any idea for this?

point me out please, I write C++ opencv for a while and remember just a bit of java.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-07-25 06:46:20 -0600

berak gravatar image

i think, you wanted:

Imgproc.cvtColor(mRgba,mRgb,Imgproc.COLOR_RGBA2RGB);

instead of

mRgba.convertTo(mRgb, CvType.CV_8UC3);
edit flag offensive delete link more

Comments

Thanks a lot. It works! And why convertto() is not working at all? BTW, where should I find these kinds of handbook for javacv?

flankechen gravatar imageflankechen ( 2013-07-25 21:36:52 -0600 )edit

Question Tools

Stats

Asked: 2013-07-25 06:36:20 -0600

Seen: 1,122 times

Last updated: Jul 25 '13