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

stylizeImage 这个方法只能接收一个正方形的图片吗?我换了长方形的Bitmap,就会崩溃。 #5

Open
shenbuqingyun opened this issue Sep 12, 2019 · 5 comments

Comments

@shenbuqingyun
Copy link

No description provided.

@shenbuqingyun
Copy link
Author

java.nio.BufferOverflowException

@shenbuqingyun
Copy link
Author

我在tensoflow的项目下,找到的实现方式也是正方形。请问一下,您这边又没有测试过这个问题。

@shenbuqingyun
Copy link
Author

感谢!

@jascals
Copy link
Owner

jascals commented Sep 12, 2019

private int[] intValues = new int[desiredSize * desiredSize];
private float[] floatValues = new float[desiredSize * desiredSize * 3];

在使用bitmap之前调用了createScaledBitmap,这个函数里我写死了数组格式,所以是默认正方形的。
看exception是因为buffer溢出,你可以根据图像大小调整下数组试试看

@shenbuqingyun
Copy link
Author

经测试 把接收结果的数组 人为扩大两倍,就可以避免崩溃的问题。但是处理后的图片效果很差。猜测应该是原模型文件做了限制。同样使用TensorflowInterface的API,运行其他模型文件,可以正常处理其他尺寸图片。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants