URL
https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk
Subversion Repositories qaz_libs
Compare Revisions
- This comparison shows the changes necessary to convert path
/qaz_libs/trunk/BFM/sim
- from Rev 50 to Rev 49
- ↔ Reverse comparison
Rev 50 → Rev 49
/tests/tb_video_frame_dpi/py_raw_to_frame.py
0,0 → 1,92
# |
# //////////////////////////////////////////////////////////////////// |
# // //// |
# // Copyright (C) 2018 Authors and OPENCORES.ORG //// |
# // //// |
# // This source file may be used and distributed without //// |
# // restriction provided that this copyright statement is not //// |
# // removed from the file and that any derivative work contains //// |
# // the original copyright notice and the associated disclaimer. //// |
# // //// |
# // This source file is free software; you can redistribute it //// |
# // and/or modify it under the terms of the GNU Lesser General //// |
# // Public License as published by the Free Software Foundation; //// |
# // either version 2.1 of the License, or (at your option) any //// |
# // later version. //// |
# // //// |
# // This source is distributed in the hope that it will be //// |
# // useful, but WITHOUT ANY WARRANTY; without even the implied //// |
# // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //// |
# // PURPOSE. See the GNU Lesser General Public License for more //// |
# // details. //// |
# // //// |
# // You should have received a copy of the GNU Lesser General //// |
# // Public License along with this source; if not, download it //// |
# // from http://www.opencores.org/lgpl.shtml //// |
# // //// |
# //////////////////////////////////////////////////////////////////// |
import sys |
# import sv_video |
import numpy as np |
# import matplotlib.pyplot as plt |
|
print("^^^ | py_raw_to_frame |") |
print('Number of arguments:', len(sys.argv), 'arguments.') |
print('Argument List:', str(sys.argv)) |
|
# dataSend = np.arange(1, 9 + 1, dtype=np.uint32) |
|
# tiny_frame = np.arange(32, 32 + 32, dtype=np.uint32) |
# data_list = tiny_frame.flatten() |
# data_list = tiny_frame.tolist() |
|
# sv_video.py_list_to_c_array(data_list) |
|
# --------------------------------------------------------- |
v_frames = 1 |
v_width = 8 |
v_height = 16 |
|
# # fname = sys.argv[0] |
# fname = 'count.raw' |
# print("file name: ", fname) |
|
# with open(fname, 'r') as infile: |
# data = np.fromfile(infile, dtype='uint16').reshape(v_frames, v_height, v_width) |
|
# np.set_printoptions(formatter={'int':hex}) |
|
# for i in range(v_frames): |
# print(data[i]) |
# fig, ax = plt.subplots() |
# im = ax.imshow(data[i], cmap='gray') |
# ax.set(xticks=[], yticks=[]) |
# fig.colorbar(im) |
# plt.show() |
|
# from __future__ import print_function |
# with open('out.txt', 'w') as f: |
# print('qqq\n', file=f) |
# print(data[0], file=f) |
|
# f = open('out.txt','w') |
# print >>f,'some Text' |
# print >>f, data[0].flatten() |
|
# for i in range(v_frames*v_height*v_width): |
# print >>f, data[0].flatten()[i] |
|
# data = np.arange(v_frames*v_width*v_height, dtype='uint16') |
# data = data.reshape(v_frames, v_height, v_width) |
|
# f = open('count.raw','r') |
data = np.fromfile('count.raw', dtype='uint16') |
|
print(data) |
print(data.shape) |
|
# with open('init_test.do') as fp: |
# for line in fp: |
# print line |
|
|