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

Subversion Repositories mkjpeg

[/] [mkjpeg/] [trunk/] [tb/] [matlab/] [txt2img.m] - Blame information for rev 49

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

Line No. Rev Author Line
1 25 mikel262
clear
2
fid = fopen('test.txt','r+');
3
 
4
line = fgetl(fid);
5
uns16 = sscanf(line, '%d');
6
num_comp = double(uns16);
7
 
8
line = fgetl(fid);
9
uns16 = sscanf(line, '%d');
10
y_size = double(uns16);
11
line = fgetl(fid);
12
uns16 = sscanf(line, '%d');
13
x_size = double(uns16);
14
 
15
for y = 1 : y_size ,
16
   for x = 1 : x_size ,
17
       for z = 1 : num_comp
18
         signed = fscanf(fid, '%2x',1);
19
           E(y,x,z) = uint8(signed);
20
       end
21
   end
22
end
23
 
24
imwrite(E, 'imageo.jpg','jpg','Quality',100);
25
fclose(fid);
26
 
27
return;
28
%%%%%%%%%%%%%%%
29
clear
30
fid = fopen('imagee.txt','r+');
31
 
32
line = fgetl(fid);
33
uns16 = sscanf(line, '%d');
34
y_size = double(uns16);
35
line = fgetl(fid);
36
uns16 = sscanf(line, '%d');
37
x_size = double(uns16);
38
 
39
for y = 1 : y_size ,
40
   for x = 1 : x_size ,
41
     signed = fscanf(fid, '%2x',1);
42
       E(y,x) = uint8(signed);
43
   end
44
end
45
 
46
imwrite(E, 'imagee.jpg','jpg');
47
fclose(fid);

powered by: WebSVN 2.1.0

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