Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. private void reconstruct(List<Mat> blocks) {
  2. int a = original.rows() / 8;
  3. int b = original.cols() / 8;
  4.  
  5. Mat[][] blockArray = new Mat[b][a];
  6.  
  7. for (int x = 0; x < a; x++) {
  8. for (int z = 0; z < b; z++) {
  9. int y = b * x;
  10. blockArray[x][z] = blocks.get(y + z);
  11. }
  12. }
  13.  
  14. Mat result = new Mat(b * 8, a * 8, original.type());
  15.  
  16. for (int y = 0; y < b; y++) {
  17. for (int x = 0; x < a; x++) {
  18. for (int m = 0; m < 8; m++) {
  19. for (int n = 0; n < 8; n++) {
  20. double[] values = blockArray[y][x].get(m, n);
  21. result.put(y * 8 + m, x + 8 * m, values);
  22. }
  23. }
  24. }
  25. }
  26.  
  27. showResult(result);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement