This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DM365 AutoFocus IIR coeff.s

Hello,

    I am implementing Auto Focus function by DM365, but I got some difficulty on understanding IIR filter coeff.s. I know this is not related to Ti, but my poor math problem, but, could anyone give me a reference set of coeff.s so I can focus on AF algorithm and lens control codes.

Thanks.

Bell

  • Hi Bell,

    We are also in the processing of using Auto Focus function for IPNC DM365. We have developed the necessary framework for the implementing the Auto-focus  merit function. The functionality works fine but the focus values we get vary from scene to scene. Anyway regarding your query these are the sets of IIR coefficients which we used. 

    For bright/normal light conditions,

    {8, -95, -49, 38, 76, 38, -111, -54, 17, -34, 17} can be used.

     

    For lower light conditions,

    {13, 5, -51, 10, 20, 10, 31, -51, 41, -81, 41} can be used.

    We have seen that the Threshold values need to be adjusted from scene to scene. For the start you can set it as 0.

  • Hi Arun,

        Thank you very much. I will start with the settings you had suggested.  

    Best Regards,
    Bell

  • I have tow follow up questions on the filter coefficients. (I am using DM355, but I suppose there is not much difference to DM365).

    First, if I set the coefficients as

    { 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0 }

    ,which passes the input values to the output values without changing anything, and  if I set the accumlation mode to

    ACCUMULATOR_SUMMED

    shouldn't then be the focus value the sum of all pixel values in the paxel? Instead, I receive a constant values that seems to independent of the input values.

    Second, if I repeat the focus value computation on the same test pattern, it does not necessarily result in the same values. Is it possible that the filter states are not reseted properly under certain coniditions?

    Regards,

    Stefan

     

  • Hi Stefan.

    First of all sorry for the late reply.

    Now coming to your query, for using the vertical focus accumulator one needs to set additional parameters like -

    1) RGB pattern(RGBPOS Register). There are 6 patterns used and one needs to find out its value from IPIPE registers( (IPIPE_COLPAT Register). Make sure you have set the RGB pattern correctly.

    2) Also the number of paxals in vertical and horizontal direction should be an even number.

    3) AFINCV Register. This determines the number of lines to be skipped in FV calculation in a paxal.

    Make sure your register values are set properly.  Also for the same test pattern your result will be similar only if your focus is correct. One can see that the focus value peaks when the camera is in focus and all other times it will be much lower. 

    For starting you can place the camera to focus on some text far away. Check how the focus values change while changing the focus to that text. 

  • Hi Arun,

    Thanks a lot for the clarification. After a lot of trail and error, I have meanwhile a somehow working AF engine for the DM355, but still a long list of questions.

    For the time being:

    a) You mention in 2) that the number of paxels should be even. Do you mean the PAXVC and PAXHC values? However, I cannot find such requirement in the documentation for the DM355. PAXVC is supposed to be [0, 127] and PAXHC to be [0, 35].

    b) Which is the fixed-point format of the above coefficients? Is it S12Q6? I tried to reverse engineer the above filters, but both of them seem to be unstable. Could you confirm that?

    Thanks for your support.

    Stefan

     

  • Hi Stefan,

     

    The number of Paxals in horizontal and vertical direction does refer to PAXVC and PAXHC. The documentation for DM355 does not say that, but even for DM365 the documentation is the same. But in DM365 the registers are set as floor(PAXVC/2) and floor(PAXHC/2). So i guess it should be the same way in DM355.

    The filter coefficients given above were given to me by the R&D guys. So i have not checked the stability of the filters. 

    Regards

    Arun

  • Hi Arun,

    I understand, but actually, I am using odd or even values and it seems to work correctly, because the buffer size returned by icotl(fd, AF_S_PARAM, &cfg) corresponds to my parameters and the resulting auto-focus values are also reasonable.

    However, I do not write the registers directly, but using the AF driver, which might adjust the values such that they match correctly with the hardware specifications.

    Regards,

    Stefan