001package org.opencv.core;
002
003import java.nio.ByteBuffer;
004
005// C++: class Mat
006//javadoc: Mat
007public class Mat {
008
009    public final long nativeObj;
010
011    public Mat(long addr) {
012        if (addr == 0)
013            throw new UnsupportedOperationException("Native object address is NULL");
014        nativeObj = addr;
015    }
016
017    //
018    // C++: Mat::Mat()
019    //
020
021    // javadoc: Mat::Mat()
022    public Mat() {
023        nativeObj = n_Mat();
024    }
025
026    //
027    // C++: Mat::Mat(int rows, int cols, int type)
028    //
029
030    // javadoc: Mat::Mat(rows, cols, type)
031    public Mat(int rows, int cols, int type) {
032        nativeObj = n_Mat(rows, cols, type);
033    }
034
035    //
036    // C++: Mat::Mat(int rows, int cols, int type, void* data)
037    //
038
039    // javadoc: Mat::Mat(rows, cols, type, data)
040    public Mat(int rows, int cols, int type, ByteBuffer data) {
041        nativeObj = n_Mat(rows, cols, type, data);
042    }
043
044    //
045    // C++: Mat::Mat(int rows, int cols, int type, void* data, size_t step)
046    //
047
048    // javadoc: Mat::Mat(rows, cols, type, data, step)
049    public Mat(int rows, int cols, int type, ByteBuffer data, long step) {
050        nativeObj = n_Mat(rows, cols, type, data, step);
051    }
052
053    //
054    // C++: Mat::Mat(Size size, int type)
055    //
056
057    // javadoc: Mat::Mat(size, type)
058    public Mat(Size size, int type) {
059        nativeObj = n_Mat(size.width, size.height, type);
060    }
061
062    //
063    // C++: Mat::Mat(int ndims, const int* sizes, int type)
064    //
065
066    // javadoc: Mat::Mat(sizes, type)
067    public Mat(int[] sizes, int type) {
068        nativeObj = n_Mat(sizes.length, sizes, type);
069    }
070
071    //
072    // C++: Mat::Mat(int rows, int cols, int type, Scalar s)
073    //
074
075    // javadoc: Mat::Mat(rows, cols, type, s)
076    public Mat(int rows, int cols, int type, Scalar s) {
077        nativeObj = n_Mat(rows, cols, type, s.val[0], s.val[1], s.val[2], s.val[3]);
078    }
079
080    //
081    // C++: Mat::Mat(Size size, int type, Scalar s)
082    //
083
084    // javadoc: Mat::Mat(size, type, s)
085    public Mat(Size size, int type, Scalar s) {
086        nativeObj = n_Mat(size.width, size.height, type, s.val[0], s.val[1], s.val[2], s.val[3]);
087    }
088
089    //
090    // C++: Mat::Mat(int ndims, const int* sizes, int type, Scalar s)
091    //
092
093    // javadoc: Mat::Mat(sizes, type, s)
094    public Mat(int[] sizes, int type, Scalar s) {
095        nativeObj = n_Mat(sizes.length, sizes, type, s.val[0], s.val[1], s.val[2], s.val[3]);
096    }
097
098    //
099    // C++: Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all())
100    //
101
102    // javadoc: Mat::Mat(m, rowRange, colRange)
103    public Mat(Mat m, Range rowRange, Range colRange) {
104        nativeObj = n_Mat(m.nativeObj, rowRange.start, rowRange.end, colRange.start, colRange.end);
105    }
106
107    // javadoc: Mat::Mat(m, rowRange)
108    public Mat(Mat m, Range rowRange) {
109        nativeObj = n_Mat(m.nativeObj, rowRange.start, rowRange.end);
110    }
111
112    //
113    // C++: Mat::Mat(const Mat& m, const std::vector<Range>& ranges)
114    //
115
116    // javadoc: Mat::Mat(m, ranges)
117    public Mat(Mat m, Range[] ranges) {
118        nativeObj = n_Mat(m.nativeObj, ranges);
119    }
120
121    //
122    // C++: Mat::Mat(Mat m, Rect roi)
123    //
124
125    // javadoc: Mat::Mat(m, roi)
126    public Mat(Mat m, Rect roi) {
127        nativeObj = n_Mat(m.nativeObj, roi.y, roi.y + roi.height, roi.x, roi.x + roi.width);
128    }
129
130    //
131    // C++: Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
132    //
133
134    // javadoc: Mat::adjustROI(dtop, dbottom, dleft, dright)
135    public Mat adjustROI(int dtop, int dbottom, int dleft, int dright) {
136        return new Mat(n_adjustROI(nativeObj, dtop, dbottom, dleft, dright));
137    }
138
139    //
140    // C++: void Mat::assignTo(Mat m, int type = -1)
141    //
142
143    // javadoc: Mat::assignTo(m, type)
144    public void assignTo(Mat m, int type) {
145        n_assignTo(nativeObj, m.nativeObj, type);
146    }
147
148    // javadoc: Mat::assignTo(m)
149    public void assignTo(Mat m) {
150        n_assignTo(nativeObj, m.nativeObj);
151    }
152
153    //
154    // C++: int Mat::channels()
155    //
156
157    // javadoc: Mat::channels()
158    public int channels() {
159        return n_channels(nativeObj);
160    }
161
162    //
163    // C++: int Mat::checkVector(int elemChannels, int depth = -1, bool
164    // requireContinuous = true)
165    //
166
167    // javadoc: Mat::checkVector(elemChannels, depth, requireContinuous)
168    public int checkVector(int elemChannels, int depth, boolean requireContinuous) {
169        return n_checkVector(nativeObj, elemChannels, depth, requireContinuous);
170    }
171
172    // javadoc: Mat::checkVector(elemChannels, depth)
173    public int checkVector(int elemChannels, int depth) {
174        return n_checkVector(nativeObj, elemChannels, depth);
175    }
176
177    // javadoc: Mat::checkVector(elemChannels)
178    public int checkVector(int elemChannels) {
179        return n_checkVector(nativeObj, elemChannels);
180    }
181
182    //
183    // C++: Mat Mat::clone()
184    //
185
186    // javadoc: Mat::clone()
187    public Mat clone() {
188        return new Mat(n_clone(nativeObj));
189    }
190
191    //
192    // C++: Mat Mat::col(int x)
193    //
194
195    // javadoc: Mat::col(x)
196    public Mat col(int x) {
197        return new Mat(n_col(nativeObj, x));
198    }
199
200    //
201    // C++: Mat Mat::colRange(int startcol, int endcol)
202    //
203
204    // javadoc: Mat::colRange(startcol, endcol)
205    public Mat colRange(int startcol, int endcol) {
206        return new Mat(n_colRange(nativeObj, startcol, endcol));
207    }
208
209    //
210    // C++: Mat Mat::colRange(Range r)
211    //
212
213    // javadoc: Mat::colRange(r)
214    public Mat colRange(Range r) {
215        return new Mat(n_colRange(nativeObj, r.start, r.end));
216    }
217
218    //
219    // C++: int Mat::dims()
220    //
221
222    // javadoc: Mat::dims()
223    public int dims() {
224        return n_dims(nativeObj);
225    }
226
227    //
228    // C++: int Mat::cols()
229    //
230
231    // javadoc: Mat::cols()
232    public int cols() {
233        return n_cols(nativeObj);
234    }
235
236    //
237    // C++: void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta
238    // = 0)
239    //
240
241    // javadoc: Mat::convertTo(m, rtype, alpha, beta)
242    public void convertTo(Mat m, int rtype, double alpha, double beta) {
243        n_convertTo(nativeObj, m.nativeObj, rtype, alpha, beta);
244    }
245
246    // javadoc: Mat::convertTo(m, rtype, alpha)
247    public void convertTo(Mat m, int rtype, double alpha) {
248        n_convertTo(nativeObj, m.nativeObj, rtype, alpha);
249    }
250
251    // javadoc: Mat::convertTo(m, rtype)
252    public void convertTo(Mat m, int rtype) {
253        n_convertTo(nativeObj, m.nativeObj, rtype);
254    }
255
256    //
257    // C++: void Mat::copyTo(Mat& m)
258    //
259
260    // javadoc: Mat::copyTo(m)
261    public void copyTo(Mat m) {
262        n_copyTo(nativeObj, m.nativeObj);
263    }
264
265    //
266    // C++: void Mat::copyTo(Mat& m, Mat mask)
267    //
268
269    // javadoc: Mat::copyTo(m, mask)
270    public void copyTo(Mat m, Mat mask) {
271        n_copyTo(nativeObj, m.nativeObj, mask.nativeObj);
272    }
273
274    //
275    // C++: void Mat::create(int rows, int cols, int type)
276    //
277
278    // javadoc: Mat::create(rows, cols, type)
279    public void create(int rows, int cols, int type) {
280        n_create(nativeObj, rows, cols, type);
281    }
282
283    //
284    // C++: void Mat::create(Size size, int type)
285    //
286
287    // javadoc: Mat::create(size, type)
288    public void create(Size size, int type) {
289        n_create(nativeObj, size.width, size.height, type);
290    }
291
292    //
293    // C++: void Mat::create(int ndims, const int* sizes, int type)
294    //
295
296    // javadoc: Mat::create(sizes, type)
297    public void create(int[] sizes, int type) {
298        n_create(nativeObj, sizes.length, sizes, type);
299    }
300
301    //
302    // C++: void Mat::copySize(const Mat& m);
303    //
304
305    // javadoc: Mat::copySize(m)
306    public void copySize(Mat m) {
307        n_copySize(nativeObj, m.nativeObj);
308    }
309
310    //
311    // C++: Mat Mat::cross(Mat m)
312    //
313
314    // javadoc: Mat::cross(m)
315    public Mat cross(Mat m) {
316        return new Mat(n_cross(nativeObj, m.nativeObj));
317    }
318
319    //
320    // C++: long Mat::dataAddr()
321    //
322
323    // javadoc: Mat::dataAddr()
324    public long dataAddr() {
325        return n_dataAddr(nativeObj);
326    }
327
328    //
329    // C++: int Mat::depth()
330    //
331
332    // javadoc: Mat::depth()
333    public int depth() {
334        return n_depth(nativeObj);
335    }
336
337    //
338    // C++: Mat Mat::diag(int d = 0)
339    //
340
341    // javadoc: Mat::diag(d)
342    public Mat diag(int d) {
343        return new Mat(n_diag(nativeObj, d));
344    }
345
346    // javadoc: Mat::diag()
347    public Mat diag() {
348        return new Mat(n_diag(nativeObj, 0));
349    }
350
351    //
352    // C++: static Mat Mat::diag(Mat d)
353    //
354
355    // javadoc: Mat::diag(d)
356    public static Mat diag(Mat d) {
357        return new Mat(n_diag(d.nativeObj));
358    }
359
360    //
361    // C++: double Mat::dot(Mat m)
362    //
363
364    // javadoc: Mat::dot(m)
365    public double dot(Mat m) {
366        return n_dot(nativeObj, m.nativeObj);
367    }
368
369    //
370    // C++: size_t Mat::elemSize()
371    //
372
373    // javadoc: Mat::elemSize()
374    public long elemSize() {
375        return n_elemSize(nativeObj);
376    }
377
378    //
379    // C++: size_t Mat::elemSize1()
380    //
381
382    // javadoc: Mat::elemSize1()
383    public long elemSize1() {
384        return n_elemSize1(nativeObj);
385    }
386
387    //
388    // C++: bool Mat::empty()
389    //
390
391    // javadoc: Mat::empty()
392    public boolean empty() {
393        return n_empty(nativeObj);
394    }
395
396    //
397    // C++: static Mat Mat::eye(int rows, int cols, int type)
398    //
399
400    // javadoc: Mat::eye(rows, cols, type)
401    public static Mat eye(int rows, int cols, int type) {
402        return new Mat(n_eye(rows, cols, type));
403    }
404
405    //
406    // C++: static Mat Mat::eye(Size size, int type)
407    //
408
409    // javadoc: Mat::eye(size, type)
410    public static Mat eye(Size size, int type) {
411        return new Mat(n_eye(size.width, size.height, type));
412    }
413
414    //
415    // C++: Mat Mat::inv(int method = DECOMP_LU)
416    //
417
418    // javadoc: Mat::inv(method)
419    public Mat inv(int method) {
420        return new Mat(n_inv(nativeObj, method));
421    }
422
423    // javadoc: Mat::inv()
424    public Mat inv() {
425        return new Mat(n_inv(nativeObj));
426    }
427
428    //
429    // C++: bool Mat::isContinuous()
430    //
431
432    // javadoc: Mat::isContinuous()
433    public boolean isContinuous() {
434        return n_isContinuous(nativeObj);
435    }
436
437    //
438    // C++: bool Mat::isSubmatrix()
439    //
440
441    // javadoc: Mat::isSubmatrix()
442    public boolean isSubmatrix() {
443        return n_isSubmatrix(nativeObj);
444    }
445
446    //
447    // C++: void Mat::locateROI(Size wholeSize, Point ofs)
448    //
449
450    // javadoc: Mat::locateROI(wholeSize, ofs)
451    public void locateROI(Size wholeSize, Point ofs) {
452        double[] wholeSize_out = new double[2];
453        double[] ofs_out = new double[2];
454        locateROI_0(nativeObj, wholeSize_out, ofs_out);
455        if (wholeSize != null) {
456            wholeSize.width = wholeSize_out[0];
457            wholeSize.height = wholeSize_out[1];
458        }
459        if (ofs != null) {
460            ofs.x = ofs_out[0];
461            ofs.y = ofs_out[1];
462        }
463    }
464
465    //
466    // C++: Mat Mat::mul(Mat m, double scale = 1)
467    //
468
469    // javadoc: Mat::mul(m, scale)
470    public Mat mul(Mat m, double scale) {
471        return new Mat(n_mul(nativeObj, m.nativeObj, scale));
472    }
473
474    // javadoc: Mat::mul(m)
475    public Mat mul(Mat m) {
476        return new Mat(n_mul(nativeObj, m.nativeObj));
477    }
478
479    //
480    // C++: static Mat Mat::ones(int rows, int cols, int type)
481    //
482
483    // javadoc: Mat::ones(rows, cols, type)
484    public static Mat ones(int rows, int cols, int type) {
485        return new Mat(n_ones(rows, cols, type));
486    }
487
488    //
489    // C++: static Mat Mat::ones(Size size, int type)
490    //
491
492    // javadoc: Mat::ones(size, type)
493    public static Mat ones(Size size, int type) {
494        return new Mat(n_ones(size.width, size.height, type));
495    }
496
497    //
498    // C++: static Mat Mat::ones(int ndims, const int* sizes, int type)
499    //
500
501    // javadoc: Mat::ones(sizes, type)
502    public static Mat ones(int[] sizes, int type) {
503        return new Mat(n_ones(sizes.length, sizes, type));
504    }
505
506    //
507    // C++: void Mat::push_back(Mat m)
508    //
509
510    // javadoc: Mat::push_back(m)
511    public void push_back(Mat m) {
512        n_push_back(nativeObj, m.nativeObj);
513    }
514
515    //
516    // C++: void Mat::release()
517    //
518
519    // javadoc: Mat::release()
520    public void release() {
521        n_release(nativeObj);
522    }
523
524    //
525    // C++: Mat Mat::reshape(int cn, int rows = 0)
526    //
527
528    // javadoc: Mat::reshape(cn, rows)
529    public Mat reshape(int cn, int rows) {
530        return new Mat(n_reshape(nativeObj, cn, rows));
531    }
532
533    // javadoc: Mat::reshape(cn)
534    public Mat reshape(int cn) {
535        return new Mat(n_reshape(nativeObj, cn));
536    }
537
538    //
539    // C++: Mat Mat::reshape(int cn, int newndims, const int* newsz)
540    //
541
542    // javadoc: Mat::reshape(cn, newshape)
543    public Mat reshape(int cn, int[] newshape) {
544        return new Mat(n_reshape_1(nativeObj, cn, newshape.length, newshape));
545    }
546
547    //
548    // C++: Mat Mat::row(int y)
549    //
550
551    // javadoc: Mat::row(y)
552    public Mat row(int y) {
553        return new Mat(n_row(nativeObj, y));
554    }
555
556    //
557    // C++: Mat Mat::rowRange(int startrow, int endrow)
558    //
559
560    // javadoc: Mat::rowRange(startrow, endrow)
561    public Mat rowRange(int startrow, int endrow) {
562        return new Mat(n_rowRange(nativeObj, startrow, endrow));
563    }
564
565    //
566    // C++: Mat Mat::rowRange(Range r)
567    //
568
569    // javadoc: Mat::rowRange(r)
570    public Mat rowRange(Range r) {
571        return new Mat(n_rowRange(nativeObj, r.start, r.end));
572    }
573
574    //
575    // C++: int Mat::rows()
576    //
577
578    // javadoc: Mat::rows()
579    public int rows() {
580        return n_rows(nativeObj);
581    }
582
583    //
584    // C++: Mat Mat::operator =(Scalar s)
585    //
586
587    // javadoc: Mat::operator =(s)
588    public Mat setTo(Scalar s) {
589        return new Mat(n_setTo(nativeObj, s.val[0], s.val[1], s.val[2], s.val[3]));
590    }
591
592    //
593    // C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
594    //
595
596    // javadoc: Mat::setTo(value, mask)
597    public Mat setTo(Scalar value, Mat mask) {
598        return new Mat(n_setTo(nativeObj, value.val[0], value.val[1], value.val[2], value.val[3], mask.nativeObj));
599    }
600
601    //
602    // C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
603    //
604
605    // javadoc: Mat::setTo(value, mask)
606    public Mat setTo(Mat value, Mat mask) {
607        return new Mat(n_setTo(nativeObj, value.nativeObj, mask.nativeObj));
608    }
609
610    // javadoc: Mat::setTo(value)
611    public Mat setTo(Mat value) {
612        return new Mat(n_setTo(nativeObj, value.nativeObj));
613    }
614
615    //
616    // C++: Size Mat::size()
617    //
618
619    // javadoc: Mat::size()
620    public Size size() {
621        return new Size(n_size(nativeObj));
622    }
623
624    //
625    // C++: int Mat::size(int i)
626    //
627
628    // javadoc: Mat::size(int i)
629    public int size(int i) {
630        return n_size_i(nativeObj, i);
631    }
632
633    //
634    // C++: size_t Mat::step1(int i = 0)
635    //
636
637    // javadoc: Mat::step1(i)
638    public long step1(int i) {
639        return n_step1(nativeObj, i);
640    }
641
642    // javadoc: Mat::step1()
643    public long step1() {
644        return n_step1(nativeObj);
645    }
646
647    //
648    // C++: Mat Mat::operator()(int rowStart, int rowEnd, int colStart, int
649    // colEnd)
650    //
651
652    // javadoc: Mat::operator()(rowStart, rowEnd, colStart, colEnd)
653    public Mat submat(int rowStart, int rowEnd, int colStart, int colEnd) {
654        return new Mat(n_submat_rr(nativeObj, rowStart, rowEnd, colStart, colEnd));
655    }
656
657    //
658    // C++: Mat Mat::operator()(Range rowRange, Range colRange)
659    //
660
661    // javadoc: Mat::operator()(rowRange, colRange)
662    public Mat submat(Range rowRange, Range colRange) {
663        return new Mat(n_submat_rr(nativeObj, rowRange.start, rowRange.end, colRange.start, colRange.end));
664    }
665
666    //
667    // C++: Mat Mat::operator()(const std::vector<Range>& ranges)
668    //
669
670    // javadoc: Mat::operator()(ranges[])
671    public Mat submat(Range[] ranges) {
672        return new Mat(n_submat_ranges(nativeObj, ranges));
673    }
674
675    //
676    // C++: Mat Mat::operator()(Rect roi)
677    //
678
679    // javadoc: Mat::operator()(roi)
680    public Mat submat(Rect roi) {
681        return new Mat(n_submat(nativeObj, roi.x, roi.y, roi.width, roi.height));
682    }
683
684    //
685    // C++: Mat Mat::t()
686    //
687
688    // javadoc: Mat::t()
689    public Mat t() {
690        return new Mat(n_t(nativeObj));
691    }
692
693    //
694    // C++: size_t Mat::total()
695    //
696
697    // javadoc: Mat::total()
698    public long total() {
699        return n_total(nativeObj);
700    }
701
702    //
703    // C++: int Mat::type()
704    //
705
706    // javadoc: Mat::type()
707    public int type() {
708        return n_type(nativeObj);
709    }
710
711    //
712    // C++: static Mat Mat::zeros(int rows, int cols, int type)
713    //
714
715    // javadoc: Mat::zeros(rows, cols, type)
716    public static Mat zeros(int rows, int cols, int type) {
717        return new Mat(n_zeros(rows, cols, type));
718    }
719
720    //
721    // C++: static Mat Mat::zeros(Size size, int type)
722    //
723
724    // javadoc: Mat::zeros(size, type)
725    public static Mat zeros(Size size, int type) {
726        return new Mat(n_zeros(size.width, size.height, type));
727    }
728
729    //
730    // C++: static Mat Mat::zeros(int ndims, const int* sizes, int type)
731    //
732
733    // javadoc: Mat::zeros(sizes, type)
734    public static Mat zeros(int[] sizes, int type) {
735        return new Mat(n_zeros(sizes.length, sizes, type));
736    }
737
738    @Override
739    protected void finalize() throws Throwable {
740        n_delete(nativeObj);
741        super.finalize();
742    }
743
744    // javadoc:Mat::toString()
745    @Override
746    public String toString() {
747        String _dims = (dims() > 0) ? "" : "-1*-1*";
748        for (int i=0; i<dims(); i++) {
749            _dims += size(i) + "*";
750        }
751        return "Mat [ " + _dims + CvType.typeToString(type()) +
752                ", isCont=" + isContinuous() + ", isSubmat=" + isSubmatrix() +
753                ", nativeObj=0x" + Long.toHexString(nativeObj) +
754                ", dataAddr=0x" + Long.toHexString(dataAddr()) +
755                " ]";
756    }
757
758    // javadoc:Mat::dump()
759    public String dump() {
760        return nDump(nativeObj);
761    }
762
763    // javadoc:Mat::put(row,col,data)
764    public int put(int row, int col, double... data) {
765        int t = type();
766        if (data == null || data.length % CvType.channels(t) != 0)
767            throw new UnsupportedOperationException(
768                    "Provided data element number (" +
769                            (data == null ? 0 : data.length) +
770                            ") should be multiple of the Mat channels count (" +
771                            CvType.channels(t) + ")");
772        return nPutD(nativeObj, row, col, data.length, data);
773    }
774
775    // javadoc:Mat::put(idx,data)
776    public int put(int[] idx, double... data) {
777        int t = type();
778        if (data == null || data.length % CvType.channels(t) != 0)
779            throw new UnsupportedOperationException(
780                    "Provided data element number (" +
781                            (data == null ? 0 : data.length) +
782                            ") should be multiple of the Mat channels count (" +
783                            CvType.channels(t) + ")");
784        if (idx.length != dims())
785            throw new IllegalArgumentException("Incorrect number of indices");
786        return nPutDIdx(nativeObj, idx, data.length, data);
787    }
788
789    // javadoc:Mat::put(row,col,data)
790    public int put(int row, int col, float[] data) {
791        int t = type();
792        if (data == null || data.length % CvType.channels(t) != 0)
793            throw new UnsupportedOperationException(
794                    "Provided data element number (" +
795                            (data == null ? 0 : data.length) +
796                            ") should be multiple of the Mat channels count (" +
797                            CvType.channels(t) + ")");
798        if (CvType.depth(t) == CvType.CV_32F) {
799            return nPutF(nativeObj, row, col, data.length, data);
800        }
801        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
802    }
803
804    // javadoc:Mat::put(idx,data)
805    public int put(int[] idx, float[] data) {
806        int t = type();
807        if (data == null || data.length % CvType.channels(t) != 0)
808            throw new UnsupportedOperationException(
809                    "Provided data element number (" +
810                            (data == null ? 0 : data.length) +
811                            ") should be multiple of the Mat channels count (" +
812                            CvType.channels(t) + ")");
813        if (idx.length != dims())
814            throw new IllegalArgumentException("Incorrect number of indices");
815        if (CvType.depth(t) == CvType.CV_32F) {
816            return nPutFIdx(nativeObj, idx, data.length, data);
817        }
818        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
819    }
820
821    // javadoc:Mat::put(row,col,data)
822    public int put(int row, int col, int[] data) {
823        int t = type();
824        if (data == null || data.length % CvType.channels(t) != 0)
825            throw new UnsupportedOperationException(
826                    "Provided data element number (" +
827                            (data == null ? 0 : data.length) +
828                            ") should be multiple of the Mat channels count (" +
829                            CvType.channels(t) + ")");
830        if (CvType.depth(t) == CvType.CV_32S) {
831            return nPutI(nativeObj, row, col, data.length, data);
832        }
833        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
834    }
835
836    // javadoc:Mat::put(idx,data)
837    public int put(int[] idx, int[] data) {
838        int t = type();
839        if (data == null || data.length % CvType.channels(t) != 0)
840            throw new UnsupportedOperationException(
841                    "Provided data element number (" +
842                            (data == null ? 0 : data.length) +
843                            ") should be multiple of the Mat channels count (" +
844                            CvType.channels(t) + ")");
845        if (idx.length != dims())
846            throw new IllegalArgumentException("Incorrect number of indices");
847        if (CvType.depth(t) == CvType.CV_32S) {
848            return nPutIIdx(nativeObj, idx, data.length, data);
849        }
850        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
851    }
852
853    // javadoc:Mat::put(row,col,data)
854    public int put(int row, int col, short[] data) {
855        int t = type();
856        if (data == null || data.length % CvType.channels(t) != 0)
857            throw new UnsupportedOperationException(
858                    "Provided data element number (" +
859                            (data == null ? 0 : data.length) +
860                            ") should be multiple of the Mat channels count (" +
861                            CvType.channels(t) + ")");
862        if (CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
863            return nPutS(nativeObj, row, col, data.length, data);
864        }
865        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
866    }
867
868    // javadoc:Mat::put(idx,data)
869    public int put(int[] idx, short[] data) {
870        int t = type();
871        if (data == null || data.length % CvType.channels(t) != 0)
872            throw new UnsupportedOperationException(
873                    "Provided data element number (" +
874                            (data == null ? 0 : data.length) +
875                            ") should be multiple of the Mat channels count (" +
876                            CvType.channels(t) + ")");
877        if (idx.length != dims())
878            throw new IllegalArgumentException("Incorrect number of indices");
879        if (CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
880            return nPutSIdx(nativeObj, idx, data.length, data);
881        }
882        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
883    }
884
885    // javadoc:Mat::put(row,col,data)
886    public int put(int row, int col, byte[] data) {
887        int t = type();
888        if (data == null || data.length % CvType.channels(t) != 0)
889            throw new UnsupportedOperationException(
890                    "Provided data element number (" +
891                            (data == null ? 0 : data.length) +
892                            ") should be multiple of the Mat channels count (" +
893                            CvType.channels(t) + ")");
894        if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
895            return nPutB(nativeObj, row, col, data.length, data);
896        }
897        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
898    }
899
900    // javadoc:Mat::put(idx,data)
901    public int put(int[] idx, byte[] data) {
902        int t = type();
903        if (data == null || data.length % CvType.channels(t) != 0)
904            throw new UnsupportedOperationException(
905                    "Provided data element number (" +
906                            (data == null ? 0 : data.length) +
907                            ") should be multiple of the Mat channels count (" +
908                            CvType.channels(t) + ")");
909        if (idx.length != dims())
910            throw new IllegalArgumentException("Incorrect number of indices");
911        if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
912            return nPutBIdx(nativeObj, idx, data.length, data);
913        }
914        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
915    }
916
917    // javadoc:Mat::put(row,col,data,offset,length)
918    public int put(int row, int col, byte[] data, int offset, int length) {
919        int t = type();
920        if (data == null || length % CvType.channels(t) != 0)
921            throw new UnsupportedOperationException(
922                    "Provided data element number (" +
923                            (data == null ? 0 : data.length) +
924                            ") should be multiple of the Mat channels count (" +
925                            CvType.channels(t) + ")");
926        if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
927            return nPutBwOffset(nativeObj, row, col, length, offset, data);
928        }
929        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
930    }
931
932    // javadoc:Mat::put(idx,data,offset,length)
933    public int put(int[] idx, byte[] data, int offset, int length) {
934        int t = type();
935        if (data == null || length % CvType.channels(t) != 0)
936            throw new UnsupportedOperationException(
937                    "Provided data element number (" +
938                            (data == null ? 0 : data.length) +
939                            ") should be multiple of the Mat channels count (" +
940                            CvType.channels(t) + ")");
941        if (idx.length != dims())
942            throw new IllegalArgumentException("Incorrect number of indices");
943        if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
944            return nPutBwIdxOffset(nativeObj, idx, length, offset, data);
945        }
946        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
947    }
948
949    // javadoc:Mat::get(row,col,data)
950    public int get(int row, int col, byte[] data) {
951        int t = type();
952        if (data == null || data.length % CvType.channels(t) != 0)
953            throw new UnsupportedOperationException(
954                    "Provided data element number (" +
955                            (data == null ? 0 : data.length) +
956                            ") should be multiple of the Mat channels count (" +
957                            CvType.channels(t) + ")");
958        if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
959            return nGetB(nativeObj, row, col, data.length, data);
960        }
961        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
962    }
963
964    // javadoc:Mat::get(idx,data)
965    public int get(int[] idx, byte[] data) {
966        int t = type();
967        if (data == null || data.length % CvType.channels(t) != 0)
968            throw new UnsupportedOperationException(
969                    "Provided data element number (" +
970                            (data == null ? 0 : data.length) +
971                            ") should be multiple of the Mat channels count (" +
972                            CvType.channels(t) + ")");
973        if (idx.length != dims())
974            throw new IllegalArgumentException("Incorrect number of indices");
975        if (CvType.depth(t) == CvType.CV_8U || CvType.depth(t) == CvType.CV_8S) {
976            return nGetBIdx(nativeObj, idx, data.length, data);
977        }
978        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
979    }
980
981    // javadoc:Mat::get(row,col,data)
982    public int get(int row, int col, short[] data) {
983        int t = type();
984        if (data == null || data.length % CvType.channels(t) != 0)
985            throw new UnsupportedOperationException(
986                    "Provided data element number (" +
987                            (data == null ? 0 : data.length) +
988                            ") should be multiple of the Mat channels count (" +
989                            CvType.channels(t) + ")");
990        if (CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
991            return nGetS(nativeObj, row, col, data.length, data);
992        }
993        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
994    }
995
996    // javadoc:Mat::get(idx,data)
997    public int get(int[] idx, short[] data) {
998        int t = type();
999        if (data == null || data.length % CvType.channels(t) != 0)
1000            throw new UnsupportedOperationException(
1001                    "Provided data element number (" +
1002                            (data == null ? 0 : data.length) +
1003                            ") should be multiple of the Mat channels count (" +
1004                            CvType.channels(t) + ")");
1005        if (idx.length != dims())
1006            throw new IllegalArgumentException("Incorrect number of indices");
1007        if (CvType.depth(t) == CvType.CV_16U || CvType.depth(t) == CvType.CV_16S) {
1008            return nGetSIdx(nativeObj, idx, data.length, data);
1009        }
1010        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1011    }
1012
1013    // javadoc:Mat::get(row,col,data)
1014    public int get(int row, int col, int[] data) {
1015        int t = type();
1016        if (data == null || data.length % CvType.channels(t) != 0)
1017            throw new UnsupportedOperationException(
1018                    "Provided data element number (" +
1019                            (data == null ? 0 : data.length) +
1020                            ") should be multiple of the Mat channels count (" +
1021                            CvType.channels(t) + ")");
1022        if (CvType.depth(t) == CvType.CV_32S) {
1023            return nGetI(nativeObj, row, col, data.length, data);
1024        }
1025        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1026    }
1027
1028    // javadoc:Mat::get(idx,data)
1029    public int get(int[] idx, int[] data) {
1030        int t = type();
1031        if (data == null || data.length % CvType.channels(t) != 0)
1032            throw new UnsupportedOperationException(
1033                    "Provided data element number (" +
1034                            (data == null ? 0 : data.length) +
1035                            ") should be multiple of the Mat channels count (" +
1036                            CvType.channels(t) + ")");
1037        if (idx.length != dims())
1038            throw new IllegalArgumentException("Incorrect number of indices");
1039        if (CvType.depth(t) == CvType.CV_32S) {
1040            return nGetIIdx(nativeObj, idx, data.length, data);
1041        }
1042        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1043    }
1044
1045    // javadoc:Mat::get(row,col,data)
1046    public int get(int row, int col, float[] data) {
1047        int t = type();
1048        if (data == null || data.length % CvType.channels(t) != 0)
1049            throw new UnsupportedOperationException(
1050                    "Provided data element number (" +
1051                            (data == null ? 0 : data.length) +
1052                            ") should be multiple of the Mat channels count (" +
1053                            CvType.channels(t) + ")");
1054        if (CvType.depth(t) == CvType.CV_32F) {
1055            return nGetF(nativeObj, row, col, data.length, data);
1056        }
1057        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1058    }
1059
1060    // javadoc:Mat::get(idx,data)
1061    public int get(int[] idx, float[] data) {
1062        int t = type();
1063        if (data == null || data.length % CvType.channels(t) != 0)
1064            throw new UnsupportedOperationException(
1065                    "Provided data element number (" +
1066                            (data == null ? 0 : data.length) +
1067                            ") should be multiple of the Mat channels count (" +
1068                            CvType.channels(t) + ")");
1069        if (idx.length != dims())
1070            throw new IllegalArgumentException("Incorrect number of indices");
1071        if (CvType.depth(t) == CvType.CV_32F) {
1072            return nGetFIdx(nativeObj, idx, data.length, data);
1073        }
1074        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1075    }
1076
1077    // javadoc:Mat::get(row,col,data)
1078    public int get(int row, int col, double[] data) {
1079        int t = type();
1080        if (data == null || data.length % CvType.channels(t) != 0)
1081            throw new UnsupportedOperationException(
1082                    "Provided data element number (" +
1083                            (data == null ? 0 : data.length) +
1084                            ") should be multiple of the Mat channels count (" +
1085                            CvType.channels(t) + ")");
1086        if (CvType.depth(t) == CvType.CV_64F) {
1087            return nGetD(nativeObj, row, col, data.length, data);
1088        }
1089        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1090    }
1091
1092    // javadoc:Mat::get(idx,data)
1093    public int get(int[] idx, double[] data) {
1094        int t = type();
1095        if (data == null || data.length % CvType.channels(t) != 0)
1096            throw new UnsupportedOperationException(
1097                    "Provided data element number (" +
1098                            (data == null ? 0 : data.length) +
1099                            ") should be multiple of the Mat channels count (" +
1100                            CvType.channels(t) + ")");
1101        if (idx.length != dims())
1102            throw new IllegalArgumentException("Incorrect number of indices");
1103        if (CvType.depth(t) == CvType.CV_64F) {
1104            return nGetDIdx(nativeObj, idx, data.length, data);
1105        }
1106        throw new UnsupportedOperationException("Mat data type is not compatible: " + t);
1107    }
1108
1109    // javadoc:Mat::get(row,col)
1110    public double[] get(int row, int col) {
1111        return nGet(nativeObj, row, col);
1112    }
1113
1114    // javadoc:Mat::get(idx)
1115    public double[] get(int[] idx) {
1116        if (idx.length != dims())
1117            throw new IllegalArgumentException("Incorrect number of indices");
1118        return nGetIdx(nativeObj, idx);
1119    }
1120
1121    // javadoc:Mat::height()
1122    public int height() {
1123        return rows();
1124    }
1125
1126    // javadoc:Mat::width()
1127    public int width() {
1128        return cols();
1129    }
1130
1131    // javadoc:Mat::getNativeObjAddr()
1132    public long getNativeObjAddr() {
1133        return nativeObj;
1134    }
1135
1136    // C++: Mat::Mat()
1137    private static native long n_Mat();
1138
1139    // C++: Mat::Mat(int rows, int cols, int type)
1140    private static native long n_Mat(int rows, int cols, int type);
1141
1142    // C++: Mat::Mat(int ndims, const int* sizes, int type)
1143    private static native long n_Mat(int ndims, int[] sizes, int type);
1144
1145    // C++: Mat::Mat(int rows, int cols, int type, void* data)
1146    private static native long n_Mat(int rows, int cols, int type, ByteBuffer data);
1147
1148    // C++: Mat::Mat(int rows, int cols, int type, void* data, size_t step)
1149    private static native long n_Mat(int rows, int cols, int type, ByteBuffer data, long step);
1150
1151    // C++: Mat::Mat(Size size, int type)
1152    private static native long n_Mat(double size_width, double size_height, int type);
1153
1154    // C++: Mat::Mat(int rows, int cols, int type, Scalar s)
1155    private static native long n_Mat(int rows, int cols, int type, double s_val0, double s_val1, double s_val2, double s_val3);
1156
1157    // C++: Mat::Mat(Size size, int type, Scalar s)
1158    private static native long n_Mat(double size_width, double size_height, int type, double s_val0, double s_val1, double s_val2, double s_val3);
1159
1160    // C++: Mat::Mat(int ndims, const int* sizes, int type, Scalar s)
1161    private static native long n_Mat(int ndims, int[] sizes, int type, double s_val0, double s_val1, double s_val2, double s_val3);
1162
1163    // C++: Mat::Mat(Mat m, Range rowRange, Range colRange = Range::all())
1164    private static native long n_Mat(long m_nativeObj, int rowRange_start, int rowRange_end, int colRange_start, int colRange_end);
1165
1166    private static native long n_Mat(long m_nativeObj, int rowRange_start, int rowRange_end);
1167
1168    // C++: Mat::Mat(const Mat& m, const std::vector<Range>& ranges)
1169    private static native long n_Mat(long m_nativeObj, Range[] ranges);
1170
1171    // C++: Mat Mat::adjustROI(int dtop, int dbottom, int dleft, int dright)
1172    private static native long n_adjustROI(long nativeObj, int dtop, int dbottom, int dleft, int dright);
1173
1174    // C++: void Mat::assignTo(Mat m, int type = -1)
1175    private static native void n_assignTo(long nativeObj, long m_nativeObj, int type);
1176
1177    private static native void n_assignTo(long nativeObj, long m_nativeObj);
1178
1179    // C++: int Mat::channels()
1180    private static native int n_channels(long nativeObj);
1181
1182    // C++: int Mat::checkVector(int elemChannels, int depth = -1, bool
1183    // requireContinuous = true)
1184    private static native int n_checkVector(long nativeObj, int elemChannels, int depth, boolean requireContinuous);
1185
1186    private static native int n_checkVector(long nativeObj, int elemChannels, int depth);
1187
1188    private static native int n_checkVector(long nativeObj, int elemChannels);
1189
1190    // C++: Mat Mat::clone()
1191    private static native long n_clone(long nativeObj);
1192
1193    // C++: Mat Mat::col(int x)
1194    private static native long n_col(long nativeObj, int x);
1195
1196    // C++: Mat Mat::colRange(int startcol, int endcol)
1197    private static native long n_colRange(long nativeObj, int startcol, int endcol);
1198
1199    // C++: int Mat::dims()
1200    private static native int n_dims(long nativeObj);
1201
1202    // C++: int Mat::cols()
1203    private static native int n_cols(long nativeObj);
1204
1205    // C++: void Mat::convertTo(Mat& m, int rtype, double alpha = 1, double beta
1206    // = 0)
1207    private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype, double alpha, double beta);
1208
1209    private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype, double alpha);
1210
1211    private static native void n_convertTo(long nativeObj, long m_nativeObj, int rtype);
1212
1213    // C++: void Mat::copyTo(Mat& m)
1214    private static native void n_copyTo(long nativeObj, long m_nativeObj);
1215
1216    // C++: void Mat::copyTo(Mat& m, Mat mask)
1217    private static native void n_copyTo(long nativeObj, long m_nativeObj, long mask_nativeObj);
1218
1219    // C++: void Mat::create(int rows, int cols, int type)
1220    private static native void n_create(long nativeObj, int rows, int cols, int type);
1221
1222    // C++: void Mat::create(Size size, int type)
1223    private static native void n_create(long nativeObj, double size_width, double size_height, int type);
1224
1225    // C++: void Mat::create(int ndims, const int* sizes, int type)
1226    private static native void n_create(long nativeObj, int ndims, int[] sizes, int type);
1227
1228    // C++: void Mat::copySize(const Mat& m)
1229    private static native void n_copySize(long nativeObj, long m_nativeObj);
1230
1231    // C++: Mat Mat::cross(Mat m)
1232    private static native long n_cross(long nativeObj, long m_nativeObj);
1233
1234    // C++: long Mat::dataAddr()
1235    private static native long n_dataAddr(long nativeObj);
1236
1237    // C++: int Mat::depth()
1238    private static native int n_depth(long nativeObj);
1239
1240    // C++: Mat Mat::diag(int d = 0)
1241    private static native long n_diag(long nativeObj, int d);
1242
1243    // C++: static Mat Mat::diag(Mat d)
1244    private static native long n_diag(long d_nativeObj);
1245
1246    // C++: double Mat::dot(Mat m)
1247    private static native double n_dot(long nativeObj, long m_nativeObj);
1248
1249    // C++: size_t Mat::elemSize()
1250    private static native long n_elemSize(long nativeObj);
1251
1252    // C++: size_t Mat::elemSize1()
1253    private static native long n_elemSize1(long nativeObj);
1254
1255    // C++: bool Mat::empty()
1256    private static native boolean n_empty(long nativeObj);
1257
1258    // C++: static Mat Mat::eye(int rows, int cols, int type)
1259    private static native long n_eye(int rows, int cols, int type);
1260
1261    // C++: static Mat Mat::eye(Size size, int type)
1262    private static native long n_eye(double size_width, double size_height, int type);
1263
1264    // C++: Mat Mat::inv(int method = DECOMP_LU)
1265    private static native long n_inv(long nativeObj, int method);
1266
1267    private static native long n_inv(long nativeObj);
1268
1269    // C++: bool Mat::isContinuous()
1270    private static native boolean n_isContinuous(long nativeObj);
1271
1272    // C++: bool Mat::isSubmatrix()
1273    private static native boolean n_isSubmatrix(long nativeObj);
1274
1275    // C++: void Mat::locateROI(Size wholeSize, Point ofs)
1276    private static native void locateROI_0(long nativeObj, double[] wholeSize_out, double[] ofs_out);
1277
1278    // C++: Mat Mat::mul(Mat m, double scale = 1)
1279    private static native long n_mul(long nativeObj, long m_nativeObj, double scale);
1280
1281    private static native long n_mul(long nativeObj, long m_nativeObj);
1282
1283    // C++: static Mat Mat::ones(int rows, int cols, int type)
1284    private static native long n_ones(int rows, int cols, int type);
1285
1286    // C++: static Mat Mat::ones(Size size, int type)
1287    private static native long n_ones(double size_width, double size_height, int type);
1288
1289    // C++: static Mat Mat::ones(int ndims, const int* sizes, int type)
1290    private static native long n_ones(int ndims, int[] sizes, int type);
1291
1292    // C++: void Mat::push_back(Mat m)
1293    private static native void n_push_back(long nativeObj, long m_nativeObj);
1294
1295    // C++: void Mat::release()
1296    private static native void n_release(long nativeObj);
1297
1298    // C++: Mat Mat::reshape(int cn, int rows = 0)
1299    private static native long n_reshape(long nativeObj, int cn, int rows);
1300
1301    private static native long n_reshape(long nativeObj, int cn);
1302
1303    // C++: Mat Mat::reshape(int cn, int newndims, const int* newsz)
1304    private static native long n_reshape_1(long nativeObj, int cn, int newndims, int[] newsz);
1305
1306    // C++: Mat Mat::row(int y)
1307    private static native long n_row(long nativeObj, int y);
1308
1309    // C++: Mat Mat::rowRange(int startrow, int endrow)
1310    private static native long n_rowRange(long nativeObj, int startrow, int endrow);
1311
1312    // C++: int Mat::rows()
1313    private static native int n_rows(long nativeObj);
1314
1315    // C++: Mat Mat::operator =(Scalar s)
1316    private static native long n_setTo(long nativeObj, double s_val0, double s_val1, double s_val2, double s_val3);
1317
1318    // C++: Mat Mat::setTo(Scalar value, Mat mask = Mat())
1319    private static native long n_setTo(long nativeObj, double s_val0, double s_val1, double s_val2, double s_val3, long mask_nativeObj);
1320
1321    // C++: Mat Mat::setTo(Mat value, Mat mask = Mat())
1322    private static native long n_setTo(long nativeObj, long value_nativeObj, long mask_nativeObj);
1323
1324    private static native long n_setTo(long nativeObj, long value_nativeObj);
1325
1326    // C++: Size Mat::size()
1327    private static native double[] n_size(long nativeObj);
1328
1329    // C++: int Mat::size(int i)
1330    private static native int n_size_i(long nativeObj, int i);
1331
1332    // C++: size_t Mat::step1(int i = 0)
1333    private static native long n_step1(long nativeObj, int i);
1334
1335    private static native long n_step1(long nativeObj);
1336
1337    // C++: Mat Mat::operator()(Range rowRange, Range colRange)
1338    private static native long n_submat_rr(long nativeObj, int rowRange_start, int rowRange_end, int colRange_start, int colRange_end);
1339
1340    // C++: Mat Mat::operator()(const std::vector<Range>& ranges)
1341    private static native long n_submat_ranges(long nativeObj, Range[] ranges);
1342
1343    // C++: Mat Mat::operator()(Rect roi)
1344    private static native long n_submat(long nativeObj, int roi_x, int roi_y, int roi_width, int roi_height);
1345
1346    // C++: Mat Mat::t()
1347    private static native long n_t(long nativeObj);
1348
1349    // C++: size_t Mat::total()
1350    private static native long n_total(long nativeObj);
1351
1352    // C++: int Mat::type()
1353    private static native int n_type(long nativeObj);
1354
1355    // C++: static Mat Mat::zeros(int rows, int cols, int type)
1356    private static native long n_zeros(int rows, int cols, int type);
1357
1358    // C++: static Mat Mat::zeros(Size size, int type)
1359    private static native long n_zeros(double size_width, double size_height, int type);
1360
1361    // C++: static Mat Mat::zeros(int ndims, const int* sizes, int type)
1362    private static native long n_zeros(int ndims, int[] sizes, int type);
1363
1364    // native support for java finalize()
1365    private static native void n_delete(long nativeObj);
1366
1367    private static native int nPutD(long self, int row, int col, int count, double[] data);
1368
1369    private static native int nPutDIdx(long self, int[] idx, int count, double[] data);
1370
1371    private static native int nPutF(long self, int row, int col, int count, float[] data);
1372
1373    private static native int nPutFIdx(long self, int[] idx, int count, float[] data);
1374
1375    private static native int nPutI(long self, int row, int col, int count, int[] data);
1376
1377    private static native int nPutIIdx(long self, int[] idx, int count, int[] data);
1378
1379    private static native int nPutS(long self, int row, int col, int count, short[] data);
1380
1381    private static native int nPutSIdx(long self, int[] idx, int count, short[] data);
1382
1383    private static native int nPutB(long self, int row, int col, int count, byte[] data);
1384
1385    private static native int nPutBIdx(long self, int[] idx, int count, byte[] data);
1386
1387    private static native int nPutBwOffset(long self, int row, int col, int count, int offset, byte[] data);
1388
1389    private static native int nPutBwIdxOffset(long self, int[] idx, int count, int offset, byte[] data);
1390
1391    private static native int nGetB(long self, int row, int col, int count, byte[] vals);
1392
1393    private static native int nGetBIdx(long self, int[] idx, int count, byte[] vals);
1394
1395    private static native int nGetS(long self, int row, int col, int count, short[] vals);
1396
1397    private static native int nGetSIdx(long self, int[] idx, int count, short[] vals);
1398
1399    private static native int nGetI(long self, int row, int col, int count, int[] vals);
1400
1401    private static native int nGetIIdx(long self, int[] idx, int count, int[] vals);
1402
1403    private static native int nGetF(long self, int row, int col, int count, float[] vals);
1404
1405    private static native int nGetFIdx(long self, int[] idx, int count, float[] vals);
1406
1407    private static native int nGetD(long self, int row, int col, int count, double[] vals);
1408
1409    private static native int nGetDIdx(long self, int[] idx, int count, double[] vals);
1410
1411    private static native double[] nGet(long self, int row, int col);
1412
1413    private static native double[] nGetIdx(long self, int[] idx);
1414
1415    private static native String nDump(long self);
1416}