Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

android: how to put column into Mat

According to the best practices page we want to use the fewest calls to the JNI as possible to get the job done.

In my application, I want to add a column of data (held in a List<double> or double[] to a Mat column. Rather than doing this

public void putColumn(int colIndex, List<double> colData, MatOfDouble mat) {
    for( int i=0; i<colData.size(); i++) {
         mat.put(i, colIndex, colData[i]);
    }

I'd prefer to do this:

mat.putColumn(List<double> colData);

Thus reducing colData.size() JNI calls to 1 call. Is there such a function in the Android API?

MatOfDouble has nice calls for exporting Mat data to native: mat.toList() double[] mat.toArray but the fromArray(double...a) only seems to be for the constructor.

By the way, why the difference in declarations for float and double versions of put in MatOfDouble?

   public int put(int row, int col, double... data)

   public int put(int row, int col, float[] data)

I'm a c++ programmer and double...a is not something i'm familiar with. What does it mean?

android: how to put column into Mat

According to the best practices page we want to use the fewest calls to the JNI as possible to get the job done.

In my application, I want to add a column of data (held in a List<double> or double[] to a Mat column. Rather than doing this

public void putColumn(int colIndex, List<double> colData, MatOfDouble mat) {
    for( int i=0; i<colData.size(); i++) {
         mat.put(i, colIndex, colData[i]);
    }

I'd prefer to do something like this:

mat.putColumn(List<double> colData);

Thus reducing colData.size() JNI calls to 1 call. Is there such a function in the Android API?

MatOfDouble has nice calls for exporting Mat data to native: java: mat.toList() double[] mat.toArray but the fromArray(double...a) only seems to be for the constructor.

By the way, why the difference in declarations for float and double versions of put in MatOfDouble?

   public int put(int row, int col, double... data)

   public int put(int row, int col, float[] data)

I'm a c++ programmer and double...a is not something i'm familiar with. What does it mean?

android: how to put column into Mat

According to the best practices page we want to use the fewest calls to the JNI as possible to get the job done.

In my application, I want to add a column of data (held in a List<double> or double[] to a Mat column. Rather than doing this

public void putColumn(int colIndex, List<double> List<Double> colData, MatOfDouble mat) {
    for( int i=0; i<colData.size(); i++) {
         mat.put(i, colIndex, colData[i]);
    }

I'd prefer to do something like this:

mat.putColumn(List<double> mat.putColumn(List<Double> colData);

Thus reducing colData.size() JNI calls to 1 call. Is there such a function in the Android API?API that does this, or do I have to build one with the JNI?

MatOfDouble has nice calls for exporting Mat data to java: mat.toList() double[] mat.toArray but the fromArray(double...a) only seems to be for the constructor.

By the way, why the difference in declarations for float and double versions of put in MatOfDouble?

   public int put(int row, int col, double... data)

   public int put(int row, int col, float[] data)

I'm a c++ programmer and double...a is not something i'm familiar with. What does it mean?

android: how to put a column into Mat

According to the best practices page we want to use the fewest calls to the JNI as possible to get the job done.

In my application, I want to add a column of data (held in a List<double> or double[] to a Mat column. Rather than doing this

public void putColumn(int colIndex, List<Double> colData, MatOfDouble mat) {
    for( int i=0; i<colData.size(); i++) {
         mat.put(i, colIndex, colData[i]);
    }

I'd prefer to do something like this:

mat.putColumn(List<Double> colData);

Thus reducing colData.size() the number of JNI calls from colData.size() to 1 call. Is there such a function in the Android API that does this, or do I have to build one with the JNI?

MatOfDouble has nice calls for exporting Mat data to java: mat.toList() java:
List<double> mat.toList()
double[] mat.toArray mat.toArray()
but the fromArray(double...a) only seems to be for the constructor.

By the way, why the difference in declarations for float and double versions of put in MatOfDouble?

   public int put(int row, int col, double... data)

   public int put(int row, int col, float[] data)

I'm a c++ programmer and double...a "double...a" is not something i'm familiar with. What does it mean?

click to hide/show revision 5
formatting, tags

android: how to put a column into Mat

According to the best practices page we want to use the fewest calls to the JNI as possible to get the job done.

In my application, I want to add a column of data (held in a List<double> or double[] to a Mat column. Rather than doing this

public void putColumn(int colIndex, List<Double> colData, MatOfDouble mat) {
    for( int i=0; i<colData.size(); i++) {
         mat.put(i, colIndex, colData[i]);
    }

I'd prefer to do something like this:

mat.putColumn(List<Double> colData);

Thus reducing the number of JNI calls from colData.size() to 1 call. Is there such a function in the Android API that does this, or do I have to build one with the JNI?

MatOfDouble MatOfDouble has nice calls for exporting Mat data to java:
List<double> mat.toList() List<Double> mat.toList()
double[] mat.toArray()
but the fromArray(double...a) fromArray(double...a) only seems to be for the constructor.

By the way, why the difference in declarations for float and double versions of put in MatOfDouble?MatOfDouble?

   public int put(int row, int col, double... data)

   public int put(int row, int col, float[] data)

I'm a c++ programmer and "double...a" "double...a" is not something i'm familiar with. What does it mean?