OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [sim/] [tests/] [tb_video_frame_dpi/] [py_video.py] - Blame information for rev 49

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 43 qaztronic
#
2 44 qaztronic
# ////////////////////////////////////////////////////////////////////
3
# //                                                              ////
4
# // Copyright (C) 2018 Authors and OPENCORES.ORG                 ////
5
# //                                                              ////
6
# // This source file may be used and distributed without         ////
7
# // restriction provided that this copyright statement is not    ////
8
# // removed from the file and that any derivative work contains  ////
9
# // the original copyright notice and the associated disclaimer. ////
10
# //                                                              ////
11
# // This source file is free software; you can redistribute it   ////
12
# // and/or modify it under the terms of the GNU Lesser General   ////
13
# // Public License as published by the Free Software Foundation; ////
14
# // either version 2.1 of the License, or (at your option) any   ////
15
# // later version.                                               ////
16
# //                                                              ////
17
# // This source is distributed in the hope that it will be       ////
18
# // useful, but WITHOUT ANY WARRANTY; without even the implied   ////
19
# // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
20
# // PURPOSE.  See the GNU Lesser General Public License for more ////
21
# // details.                                                     ////
22
# //                                                              ////
23
# // You should have received a copy of the GNU Lesser General    ////
24
# // Public License along with this source; if not, download it   ////
25
# // from http://www.opencores.org/lgpl.shtml                     ////
26
# //                                                              ////
27
# ////////////////////////////////////////////////////////////////////
28 43 qaztronic
import numpy as np
29
import matplotlib.pyplot as plt
30
 
31
fname = 'count.raw'
32
v_frames = 1
33
v_width = 8
34
v_height = 16
35
 
36
data = np.arange(v_frames*v_width*v_height, dtype='uint16')
37
 
38
with open(fname, 'w+') as infile:
39
  data.tofile(infile, format='uint16')
40
 
41
infile.close()
42
 
43
# ---------------------------------------------------------
44
with open(fname, 'r') as infile:
45
  data = np.fromfile(infile, dtype='uint16').reshape(v_frames, v_height, v_width)
46
 
47
np.set_printoptions(formatter={'int':hex})
48
 
49
for i in range(v_frames):
50
  fig, ax = plt.subplots()
51
  im = ax.imshow(data[i], cmap='gray')
52
  ax.set(xticks=[], yticks=[])
53
  fig.colorbar(im)
54
  plt.show()
55
 
56
print(data[0])

powered by: WebSVN 2.1.0

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