www.pudn.com > GPU-KLT-1.0.zip > klt_detector_discriminator.cg


/*
Copyright (c) 2008 University of North Carolina at Chapel Hill

This file is part of GPU-KLT.

GPU-KLT is free software: you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.

GPU-KLT is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
details.

You should have received a copy of the GNU Lesser General Public License along
with GPU-KLT. If not, see .
*/

void main(uniform sampler2D src_tex : TEXUNIT0,
          float2 st0 : TEXCOORD0,
          float4 st1 : TEXCOORD1,
          float4 st2 : TEXCOORD2,
          uniform float2 wh,
          out float4 color : COLOR)
{
   float4 vals;

   //st1 += 0.5f / wh.xyxy;
   //st2 += 0.5f / wh.xyxy;

   vals.x = pack_4ubyte(tex2D(src_tex, st1.xy));
   vals.y = pack_4ubyte(tex2D(src_tex, st1.zw));
   vals.z = pack_4ubyte(tex2D(src_tex, st2.xy));
   vals.w = pack_4ubyte(tex2D(src_tex, st2.zw));

   vals = (vals > float4(0)) ? float4(1) : float4(0);

   color = vals;
}