OpenCores
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/tests/tb_video_frame_dpi
    from Rev 44 to Rev 45
    Reverse comparison

Rev 44 → Rev 45

/count.raw Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/py_dpi.c
90,7 → 90,6
 
char pre_string[] = "exec(open('./";
char post_string[] = "').read())";
char v_filename[] = "try_it.py";
unsigned int size = (sizeof(pre_string) + sizeof(post_string)) * sizeof(char);
size += strlen(filename);
char *run_string = (char *)malloc(size);
/view_raw.py
0,0 → 1,42
#
 
import os
import numpy as np
import matplotlib.pyplot as plt
 
fname = 'count.raw'
number_of_frames = 4
width = 32
height = 32
# dtype='uint16'
dtype=np.dtype('uint16')
 
data = np.arange(number_of_frames*width*height, dtype=dtype)
# data = np.ones((number_of_frames, width, height), dtype=dtype)
# data = np.zeros((number_of_frames, width, height), dtype=dtype)
# data *= 32
 
with open(fname, 'w+') as infile:
data.tofile(infile, format=dtype.str)
 
infile.close()
 
statinfo = os.stat(fname)
print(statinfo.st_size, ': file size')
print(statinfo.st_size / (width * height * dtype.itemsize), ': frames')
print(dtype.itemsize, ': itemsize')
 
 
# with open(fname, 'r') as infile:
# data = np.fromfile(infile, dtype=dtype).reshape(number_of_frames, width, height)
data = np.memmap(fname, dtype=dtype, mode='r', shape=(number_of_frames, width, height))
 
for i in range(number_of_frames):
print('Frame #', i)
fig, ax = plt.subplots()
im = ax.imshow(data[i], cmap='gray')
ax.set(xticks=[], yticks=[])
fig.colorbar(im)
plt.show()
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.