Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade some int to long to allow Mat > 2^31 #700

Merged
merged 4 commits into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1597,5 +1597,5 @@ void operator ()(Pixel &pixel, const int * position) {
public native @ByVal Size size();
@MemberGetter public native int size(int i);
@MemberGetter public native long step();
@MemberGetter public native int step(int i);
@MemberGetter public native long step(int i);
}
Original file line number Diff line number Diff line change
Expand Up @@ -298,5 +298,5 @@ public class UMat extends Pointer {
public native @ByVal Size size();
@MemberGetter public native int size(int i);
@MemberGetter public native long step();
@MemberGetter public native int step(int i);
@MemberGetter public native long step(int i);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public abstract class AbstractArray extends Pointer implements Indexable {
public abstract int arrayWidth();
public abstract int arrayHeight();
public abstract IplROI arrayROI();
public abstract int arraySize();
public abstract long arraySize();
public abstract BytePointer arrayData();
public abstract int arrayStep();
public abstract long arrayStep();

/** @return {@code createBuffer(0)} */
public <B extends Buffer> B createBuffer() {
Expand All @@ -36,7 +36,7 @@ public <B extends Buffer> B createBuffer() {
/** @return {@link #arrayData()} wrapped in a {@link Buffer} of appropriate type starting at given index */
public <B extends Buffer> B createBuffer(int index) {
BytePointer ptr = arrayData();
int size = arraySize();
long size = arraySize();
switch (arrayDepth()) {
case IPL_DEPTH_8U:
case IPL_DEPTH_8S: return (B)ptr.position(index).capacity(size).asBuffer();
Expand All @@ -57,7 +57,7 @@ public <I extends Indexer> I createIndexer() {
}
@Override public <I extends Indexer> I createIndexer(boolean direct) {
BytePointer ptr = arrayData();
int size = arraySize();
long size = arraySize();
long[] sizes = { arrayHeight(), arrayWidth(), arrayChannels() };
long[] strides = { arrayStep(), arrayChannels(), 1 };
switch (arrayDepth()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ public int size() {
@Override public int arrayWidth() { return cols(); }
@Override public int arrayHeight() { return rows(); }
@Override public IplROI arrayROI() { return null; }
@Override public int arraySize() { return size(); }
@Override public long arraySize() { return size(); }
@Override public BytePointer arrayData() { return data_ptr(); }
@Override public int arrayStep() { return step(); }
@Override public long arrayStep() { return step(); }

/** @see #createBuffer() */
@Deprecated public void reset() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ protected static class HeaderReleaseDeallocator extends IplImage implements Deal
@Override public int arrayWidth() { return width(); }
@Override public int arrayHeight() { return height(); }
@Override public IplROI arrayROI() { return roi(); }
@Override public int arraySize() { return imageSize(); }
@Override public long arraySize() { return imageSize(); }
@Override public BytePointer arrayData() { return imageData(); }
@Override public int arrayStep() { return widthStep(); }
@Override public long arrayStep() { return widthStep(); }

public CvMat asCvMat() {
CvMat mat = new CvMat();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class AbstractMat extends AbstractArray {
public abstract int cols();
public abstract BytePointer data();
public abstract int size(int i);
public abstract int step(int i);
public abstract long step(int i);
public abstract int dims();
public abstract long elemSize1();

Expand All @@ -42,15 +42,15 @@ public abstract class AbstractMat extends AbstractArray {
@Override public int arrayWidth() { return cols(); }
@Override public int arrayHeight() { return rows(); }
@Override public IplROI arrayROI() { return null; }
@Override public int arraySize() { return step(0)*size(0); }
@Override public long arraySize() { return step(0)*size(0); }
@Override public BytePointer arrayData() { return data(); }
@Override public int arrayStep() { return step(0); }
@Override public long arrayStep() { return step(0); }

public static final Mat EMPTY = null;

@Override public <I extends Indexer> I createIndexer(boolean direct) {
BytePointer ptr = arrayData();
int size = arraySize();
long size = arraySize();
int dims = dims();
int depth = depth();
long elemSize = elemSize1();
Expand All @@ -60,7 +60,7 @@ public abstract class AbstractMat extends AbstractArray {

for (int i=0; i<dims; i++) {
sizes[i] = size(i);
int step = step(i);
long step = step(i);
if (step%elemSize != 0) {
throw new UnsupportedOperationException("Step is not a multiple of element size");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Override public int arrayWidth() { throw new UnsupportedOperationException(); }
@Override public int arrayHeight() { throw new UnsupportedOperationException(); }
@Override public IplROI arrayROI() { throw new UnsupportedOperationException(); }
@Override public int arraySize() { throw new UnsupportedOperationException(); }
@Override public long arraySize() { throw new UnsupportedOperationException(); }
@Override public BytePointer arrayData() { throw new UnsupportedOperationException(); }
@Override public int arrayStep() { throw new UnsupportedOperationException(); }
@Override public long arrayStep() { throw new UnsupportedOperationException(); }
}
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ public void map(InfoMap infoMap) {
+ "public Mat(DoublePointer p) { this(1, Math.max(1, p.limit() - p.position()), CV_64FC1, p); }\n"))
.put(new Info("cv::Mat::zeros(int, int*, int)", "cv::Mat::ones(int, int*, int)").skip())
.put(new Info("cv::Mat::size").javaText("public native @ByVal Size size();\n@MemberGetter public native int size(int i);"))
.put(new Info("cv::Mat::step").javaText("@MemberGetter public native long step();\n@MemberGetter public native int step(int i);"))
.put(new Info("cv::Mat::step").javaText("@MemberGetter public native long step();\n@MemberGetter public native long step(int i);"))
.put(new Info("cv::UMat::zeros(int, int*, int)", "cv::UMat::ones(int, int*, int)").skip())
.put(new Info("cv::UMat::size").javaText("public native @ByVal Size size();\n@MemberGetter public native int size(int i);"))
.put(new Info("cv::UMat::step").javaText("@MemberGetter public native long step();\n@MemberGetter public native int step(int i);"))
.put(new Info("cv::UMat::step").javaText("@MemberGetter public native long step();\n@MemberGetter public native long step(int i);"))
.put(new Info("cv::DefaultDeleter<CvMat>").pointerTypes("CvMatDefaultDeleter"))

.put(new Info("std::initializer_list", "_InputArray::KindFlag").skip())
Expand Down