Ask Your Question

doubts in opencv tutorial4 in eclipse

asked 2013-03-28 07:33:16 -0600

ashokreddyvit gravatar image

updated 2013-03-28 07:39:12 -0600

berak gravatar image
 public void onCameraViewStarted(int width, int height) {
        mRgba = new Mat(height, width, CvType.CV_8UC4);
        mIntermediateMat = new Mat(height, width, CvType.CV_8UC4);
        mGrayMat = new Mat(height, width, CvType.CV_8UC1);

can someone explain me what are these CvType.CV_8UC4 and CV_8UC1??? this is from the tutorials provided by opencv for android

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-28 07:51:56 -0600

Basically it describes the format that you are creating.

A matrix of type CV_8UC4 contains

  • 8 bit unsigned integers
  • with 4 channels R G B and intensity

For the C1, this means you want a grayscale image with just a single color channel containing intensities between 0 and 255.

edit flag offensive delete link more



Just in case, I haven't read the Java documentation yet. But just beware about BGR channels ordering if you are trying to use it.

Alexandre Bizeau gravatar imageAlexandre Bizeau ( 2013-03-28 13:20:35 -0600 )edit

Channel order depends on platform and algorithms. All OpenCV algorithms and I/O on desktops are designed for BGR order. But on Android RBGA is used for frame capturing, drawing, conversion to bitmap and some other operations. Pay attention on it.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-03-29 02:36:01 -0600 )edit

Question Tools

1 follower


Asked: 2013-03-28 07:33:16 -0600

Seen: 220 times

Last updated: Mar 28 '13