Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.19 KB | None | 0 0
  1. have = [
  2.     0x62 0x39 0x2e;
  3.     0xe5 0x9f 0x8d;
  4.     0x4c 0x7d 0xac;
  5.     0x39 0x52 0x0d;
  6.     0x83 0x7b 0xbf;
  7.     0x58 0xbb 0xb1;
  8.     0xed 0x7d 0x0f;
  9.     0x2f 0x4e 0xbc;
  10.     0xed 0x45 0x5b;
  11.     0x53 0x20 0x5f;
  12.     0xbd 0xcd 0x1f;
  13.     0xe2 0x9b 0x00;
  14.     0x00 0x28 0x9f;
  15.     0x51 0xad 0x3f;
  16.     0xdd 0x1a 0x2a;
  17.     0xfe 0xde 0x00;
  18.     0xd1 0x36 0xa0;
  19.     0x00 0x7f 0xae;
  20.     0xe2 0xe0 0xe1;
  21.     0xb5 0xb4 0xb6;
  22.     0x78 0x77 0x7b;
  23.     0x37 0x37 0x3c];
  24.  
  25. want = [
  26.     0x73 0x36 0x2c;
  27.     0xd3 0x88 0x6a;
  28.     0x53 0x64 0x94;
  29.     0x53 0x4c 0x25;
  30.     0x85 0x6d 0xb0;
  31.     0x64 0xbf 0xa5;
  32.     0xe9 0x67 0x2b;
  33.     0x33 0x3e 0x96;
  34.     0xcc 0x35 0x43;
  35.     0x49 0x1a 0x3b;
  36.     0xa7 0xb2 0x13;
  37.     0xe4 0x8b 0x19;
  38.     0x1a 0x21 0x6e;
  39.     0x57 0x81 0x23;
  40.     0xbe 0x0a 0x19;
  41.     0xfd 0xbf 0x0c;
  42.     0xc4 0x3e 0x7e;
  43.     0x1e 0x5d 0x93;
  44.     0xd1 0xd5 0xd7;
  45.     0xa0 0xa0 0xa0;
  46.     0x68 0x5e 0x5e;
  47.     0x2f 0x25 0x29];
  48.  
  49. w = want ./ 255.0
  50. h = have ./ 255.0
  51.  
  52. for i = 1:size(h, 1)
  53.     t = h(i,:);
  54.     t2 = [
  55.         t 0 0 0 0 0 0;
  56.         0 0 0 t 0 0 0;
  57.         0 0 0 0 0 0 t];
  58.    
  59.     if(exist("A", "var"))
  60.         A = [A; t2];
  61.     else
  62.         A = t2;
  63.     endif
  64. endfor
  65.  
  66. for i = 1:size(w, 1)
  67.     t = w(i,:)';
  68.     if(exist("B", "var"))
  69.         B = [B; t];
  70.     else
  71.         B = t;
  72.     endif
  73. endfor
  74.  
  75. xx = A \ B;
  76. X = round([xx(1:3)'; xx(4:6)'; xx(7:9)'] .* 100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement