File: test_lsd.oct

package info (click to toggle)
mia 2.4.3-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,964 kB
  • ctags: 18,491
  • sloc: cpp: 153,197; python: 1,254; sh: 311; xml: 127; makefile: 27; csh: 24; ansic: 9
file content (36 lines) | stat: -rw-r--r-- 858 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

src=[ 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 3, 3, 2, 2, 2, 1, ...
      2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 8, 3, 4, 2, 2, ...
      3, 1, 3, 4, 5, 6, 7, 8, 3, 4, 4, 5, 6, 4, 2, 2, ...
      0, 2, 3, 4, 5, 3, 1, 4, 5, 6, 7, 3, 2, 1, 2, 10 ]; 

ref=[ 8, 8, 9, 9, 9, 3, 4, 4, 4, 4, 6, 2, 9, 9, 9, 8, ...
      9, 9, 3, 4, 5, 9, 6, 3, 1, 10, 9, 3, 5, 4, 9, 9, ...
      3, 8, 3, 4, 5, 6, 7, 3, 3, 4, 4, 5, 6, 4, 9, 9, ...
      10, 9, 3, 4, 5, 3, 8, 4, 5, 6, 7, 3, 9, 8, 9, 10 ]; 


Q = zeros(64, 10);

for i=1:64
  Q(i, ref(i)) = 1; 
endfor 

Phelp = Q * inv(Q' * Q)  * Q'; 
P = eye(size(Phelp)(1), size(Phelp)(2)) - Phelp; 
value = 0.5 * (src * P * src') 

[dsrcx,dsrcy] = gradient(reshape(src,8,8)); 


gradx =  (P * src') .* reshape(dsrcx, 1, 64)';

grady =  (P * src') .* reshape(dsrcy, 1, 64)'; 
  


gradx = reshape(gradx, 8, 8)'

grady = reshape(grady, 8, 8)'