public double[] DCT(int direction, int length, double[] X){ if (direction == 1 || direction == -1) { X=discrete_Cosine_transform(direction, length, X); } return X;}public double[] discrete_Cosine_transform(int direction, int length, double[] X){ double[] x = new double[length]; for (int i = 0; i < length; i++) { x[i] = X[i]; } for (int k = 0; k < length; k++) { double sum = 0; if (direction == 1) { for (int n = 0; n < length; n++) { sum += ((k == 0) ? (Math.sqrt(0.5)) : (1)) * x[n] * Math.cos(pi * (n + 0.5) * k / length); } } else if (direction == -1) { for (int n = 0; n < length; n++) { sum += ((n == 0) ? (Math.sqrt(0.5)) : (1)) * x[n] * Math.cos(pi * n * (k + 0.5) / length); } } X[k] = sum * Math.sqrt(2.0 / length); } return X;}@H_301_3@点赞收藏分享文章举报weixin_42138713发布了7 篇原创文章 · 获赞 0 · 访问量 117私信 关注 总结
以上是内存溢出为你收集整理的Java,Android 离散余弦变换 DCT全部内容,希望文章能够帮你解决Java,Android 离散余弦变换 DCT所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)