k = i1*Math.cos(thetaRad) + j1*Math.sin(thetaRad);
          h = Math.exp( -(i1*i1+j1*j1)/2/s/s );
          datA.data[i+j] = datA.data[i+j+1] = datA.data[i+j+2] = 128 + h*128*Math.sin(k*2*Math.PI*freq+phaseRad)*contrast*0.01;
          datA.data[i+j+3] = 255;
        }
      ctxA.putImageData(datA,0,0);
      div.style.width=div.style.height=imSize+'px';
      div.style.backgroundImage='url('+cvsA.toDataURL()+')';
    }
  </script>
</head>
<body onload='run();'>

  <div id="p1"></div> <div id="p2"></div> <