Skip to content

Commit

Permalink
* Take into account Bitmap.getRowBytes() in `AndroidFrameConverter…
Browse files Browse the repository at this point in the history
….convert(Bitmap)` (issue #1143)
  • Loading branch information
saudet committed Feb 27, 2019
1 parent 736f342 commit 531220d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Take into account `Bitmap.getRowBytes()` in `AndroidFrameConverter.convert(Bitmap)` ([issue #1143](https://github.com/bytedeco/javacv/issues/1143))
* Add `static { Loader.load(); }` in `LeptonicaFrameConverter` and `OpenCVFrameConverter` to prevent link errors ([issue #1128](https://github.com/bytedeco/javacv/issues/1128))

### January 11, 2019 version 1.4.4
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/bytedeco/javacv/AndroidFrameConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ public Frame convert(byte[] data, int width, int height) {
default: assert false;
}

if (frame == null || frame.imageWidth != bitmap.getWidth()
if (frame == null || frame.imageWidth != bitmap.getWidth() || frame.imageStride != bitmap.getRowBytes()
|| frame.imageHeight != bitmap.getHeight() || frame.imageChannels != channels) {
frame = new Frame(bitmap.getWidth(), bitmap.getHeight(), Frame.DEPTH_UBYTE, channels);
frame.imageStride = bitmap.getRowBytes();
}

// assume matching strides
Expand Down

0 comments on commit 531220d

Please sign in to comment.