Dear all,<br><br>I'm trying to do a gradient descent in my application. It was working well. But as I tried to lower the threshold(which means more iterations are happening), the application just stop rendering and give me a blank screen. Most misterious is, there is no error happens. No memory leak, no access vialation, no nothing. The program just jump out of the loop. I am really confused by this. <br>
<br>Here is my code<br><br>while(abs(CurErr - PreErr) > threshold)<br> {<br> PreErr = CurErr; <br> tPoints->Delete();<br><br> for (int i = 0; i<sizeof(para)/sizeof(double); i++)<br>
{<br> temp_para[i] = para[i]; <br> }<br><br> for(int index = 0; index < sizeof(para)/sizeof(double); index++)<br> { <br>
temp_para[index] = temp_para[index] + temp_para[index]*step; <br><br> tCamera->DeepCopy(markCamera);<br> tPoints = GenerateNewPoints(temp_para, count); <br>
<br> double err = Dist_2DLandmarks(tPoints, tCamera); <br> temp_para[index] = para[index]; <br> par_der[index] = (err - CurErr) / temp_para[index]*step; <br>
}<br><br> for(int i = 0; i < sizeof(para)/sizeof(double); i++)<br> {<br> para[i] = para[i] - par_der[i] * step; <br> }<br><br> tPoints = GenerateNewPoints(para, count);<br>
<br> tCamera->DeepCopy(markCamera); <br><br> CurErr = Dist_2DLandmarks(tPoints, tCamera);<br> count ++;<br> }<br><br>Thank you very much for any suggestions.<br><br>Best regards<br>
Long<br>