Guest User

Untitled

a guest
Feb 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3.  
  4. #define KERNEL_SIZE 5
  5. #define HEIGHT 512
  6. #define WIDTH 512
  7.  
  8. int main(void) {
  9. srand(0);
  10. std::ofstream ofs("src_data.txt");
  11. for (int i = 0; i < HEIGHT; i++) {
  12. for (int j = 0; j < WIDTH; j++) {
  13. ofs << rand() % 256 << ".0f," << std::endl;
  14. }
  15. }
  16. ofs.close();
  17.  
  18. ofs.open("kernel_data.txt");
  19. for (int i = 0; i < KERNEL_SIZE; i++) {
  20. for (int j = 0; j < KERNEL_SIZE; j++) {
  21. ofs << 1.f / (KERNEL_SIZE*KERNEL_SIZE) << "f," << std::endl;
  22. }
  23. }
  24. ofs.close();
  25. return 0;
  26. }
Add Comment
Please, Sign In to add comment