Advertisement
WarPie90

heat map of 2d correlation

Nov 26th, 2014
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.67 KB | None | 0 0
  1. {$I SimbaExt/SimbaExt.simba}
  2.  
  3. procedure buildHeatmap(var BMP:TRafBitmap; Mat:TFloatMatrix);
  4. var
  5.   _h,_l:Extended;
  6.   W,H,x,y,color:Int32;
  7. begin
  8.   W := Mat.Width()-1;
  9.   H := Mat.Height()-1;
  10.   Mat := Mat.Normalize(0,1);
  11.   BMP.SetSize(W+1,H+1);
  12.  
  13.   for y:=0 to H do
  14.     for x:=0 to W do
  15.     begin
  16.       _h := (1 - Mat[y,x]) * 100;
  17.       _l := Mat[y,x] * 50;
  18.       color := HSLToColor(_H,100,_L);
  19.       FastSetPixel(BMP.Bitmap,x,y,color);
  20.      end;
  21. end
  22.  
  23.  
  24. var
  25.   BMP1,BMP2:TRafBitmap;
  26. begin
  27.   BMP1.Open('tests/lena++.png');
  28.   BMP2.Open('tests/lena_sub.png');
  29.  
  30.   buildHeatmap(BMP1, se.MatchTemplate(BMP1,BMP2,5));
  31.   BMP1.Debug();
  32.   BMP1.Free();
  33.   BMP2.Free();
  34. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement