[android with opencv ] RGBA to signal channel
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);
sub.copyTo(mRgba.submat(r));
return mRgba;
but is doesn't work . Could anybody help me
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??