[android with opencv ] RGBA to signal channel

asked 2015-08-24 23:00:09 -0500

I want to extract green channel from input.rgba(), my code are below:

enter code here
      mRgba = inputFrame.rgba();
      Rect r = new Rect(150,50,200,200); 
      Core.rectangle(mRgba, r.tl(), r.br(), yellow, 3);
      Mat sub = mRgba.submat(r);
      Mat gchannel = new Mat();
      Core.extractChannel(sub, sub, 1);
      return mRgba;

but is doesn't work . Could anybody help me

edit retag flag offensive close merge delete


I found my bug is signal change to multi-channel, so I add this command
Imgproc.cvtColor(gchannel, gchannel, Imgproc.COLOR_GRAY2RGBA); after the command Core.extractChannel(sub, sub, 1); then is work, but I don't know is it correct answer??

blackStudent gravatar imageblackStudent ( 2015-08-24 23:15:00 -0500 )edit