Magic Lantern Forum

Developing Magic Lantern => Modules Development => Topic started by: Kent on February 20, 2013, 06:17:09 PM

Title: DotTune AFMA (dot_tune.mo)
Post by: Kent on February 20, 2013, 06:17:09 PM
An automated version of the Dot-Tune focus tuning method.

Note, this module does not add AFMA support to camera bodies that did not contain this feature in Canon firmware.


QuoteCould this be someting to automate with ML ?

Title: Re: DotTune AFMA
Post by: g3gg0 on February 20, 2013, 09:30:19 PM
interesting method.
that would be definitely a use case for the picoc scripting API.
"just" need to find out how to set the AF value property and how to get the focus confirmation.
(not sure if the known focus confirmation memory address is working for this use case)
Title: Re: DotTune AFMA
Post by: a1ex on February 20, 2013, 09:54:24 PM
Yes, the focus confirmation constant would work here.
Title: Re: DotTune AFMA
Post by: PhotoCat on February 21, 2013, 06:40:45 AM
In addition to the automation,  for a single lens, it would be nice for ML to store different AFMA values for different subject distance, since the Canon AFMA implementation is very distance dependent.  Ideally ML would apply a different AFMA value depending on the subject distance reported by the lens :) , if that is possible.
Title: Re: DotTune AFMA
Post by: horshack on February 22, 2013, 10:42:30 AM
Hey guys, this is horshack, the guy who did the DotTune YouTube video. My day job happens to be as an embedded firmware engineer so any help you think I can provide just say the word.

I looked over the source of the first commit (https://bitbucket.org/hudson/magic-lantern/commits/6cf3c98700f4b659215d14ede8d6fe15eeca2e81 (https://bitbucket.org/hudson/magic-lantern/commits/6cf3c98700f4b659215d14ede8d6fe15eeca2e81)). In the source I see the logic uses a scoring mechanism for each tune value. The scores are 0 to 4, based on a total of 4 iterations executed for each tune value (2 inner loops x 2 outer loops). Each iteration samples 'FOCUS_CONFIRMATION' 20 times, delaying 10ms (or 10us?) between each sample, and increments the score once if any of those 20 samples yields a focus confirmation.

My first question...I assume 'FOCUS_CONFIRMATION' is either a memory-mapped variable/register driven by hardware tied to the PDAF system, or is a global variable set by some background task that is polling the PDAF hardware. If it's the latter, what is the polling frequency of that background task? I ask because broadly speaking, DotTune is biased toward a negative feedback sampling methodology, whereas the ML source implementation can interpreted as either positive or negative feedback sampling, depending on the timing properties of 'FOCUS_CONFIRMATION'. I'm just trying to correlate the user-perceptible VF confirmation feedback with how that same mechanism would be sampled from the ML implementation.

Thanks,

Horshack
Title: Re: DotTune AFMA
Post by: a1ex on February 22, 2013, 11:35:41 AM
Wow, thanks for feedback!

FOCUS_CONFIRMATION is a variable in Canon code which becomes TRUE when focus confirmation is achieved. The exact meaning is unknown, but I've noticed that:
- sometimes it becomes TRUE for a short amount of time
- sometimes it stays TRUE for the entire period while focus is confirmed (until I move the camera)

I don't know if these two differences indicate stronger or weaker focus confirmation; at first sight, I didn't notice any correlation.

I've just tweaked the numbers by trial and error, so each focus beep is detected by ML. A few beeps are still missed though (5% or so).

10ms is the timing resolution for DryOS.

Focus confirmation is also sent via GUI events, but these codes are not fully understood yet. If I understand this, there will be no more hit and miss due to polling.

So... back to your question: Canon tasks use event-driven programming for this focus confirmation (so timing is probably variable), but ML uses polling because this is what we know. And one focus beep means one increment in the scoring mechanism. There are 4 passes for better accuracy.

These time-critical events (including PDAF, focus beep, shutter control, lens communication etc) happen in a small microcontroller (Tx19a) that can't be accessed from ML. We can only program the general-purpose CPU (ARM). The ARM receives many of the Tx19a events in order to update the main display and sync camera settings, but with some latency.
Title: Re: DotTune AFMA
Post by: Greg on February 22, 2013, 05:04:28 PM
It looks interesting. You can make a preset 3200K and 6500K.  ;)
Title: Re: DotTune AFMA
Post by: horshack on February 22, 2013, 08:07:58 PM
Quote from: a1ex on February 22, 2013, 11:35:41 AM
Wow, thanks for feedback!

FOCUS_CONFIRMATION is a variable

Thanks a1ex, that gives me a nice overview of the embedded environment.

Algorithmically, the ML implementation would likely want to match the human-level algorithm of DotTune, provided that the behavior FOCUS_CONFIRMATION roughly matches the behavior of confirmation dot delivered in the VF.

Q: Is msleep() only used as a method to measure time and delay, or is it also required to allow background tasks to execute? (non-preemptive yield point for DryOS). If it's the former, do you have an alternate way to measure elapsed time so that the FOCUS_CONFIRMATION loops can sample continuously without yielding? This would eliminate sampling/timing errors of the variable relative to the micro-controller/background task that updates it.

Q: Is FOCUS_CONFIRMATION updated continuously while the camera is powered on or is there an internal trigger needed to initiate the background task sampling, akin to a half-press of the shutter? I see in your source that you call fake_simple_button(). Is that for this purpose?

Q: It might take some trial and error but I think we'd need to establish roughly what the time delta is between changing an AF tune value and when the first PD sensing result in FOCUS_CONFIRMATION reflects that new value. For the purposes of the source provided below I took a swag at 100ms.

Here is source to an implementation that uses an algorithm that matches the user-level steps of DotTune. Some questions remain about how exactly FOCUS_CONFIRMATION works relative to the VF indication, so this logic may need some tweaks after debugging. Unfortunately I sold my 5DM2 some time ago and the only Canon body I have with me is a 5DM3, which seems to still be in alpha for ML.


#define TUNE_VALUE_INVALID              (INT_MIN)
#define MIN_TUNE_VALUE                  (-20)
#define MAX_TUNE_VALUE                  (20)

#define AF_TUNE_CHANGE_SETTLE_TIME_MS        (100)  // time it takes for PDAF to resample phase after changing AF tune (swag)
#define MAX_TIME_TO_FIRST_FOCUS_CONFIRM_MS   (300)  // max time we allow before 1st focus confirmation (swag)
#define MIN_CONTINUOUS_FOCUS_CONFIRM_TIME_MS (5000) // min time that focus confirmation must remain TRUE

int is_focus_confirmed(void) {
    return FOCUS_CONFIRMATION;
}

int perform_dot_tune(void) { // returns optimal AF tune value or TUNE_VALUE_INVALID

    int tuneValue;
    int confirmedTuneRangeLow, confirmedTuneRangeHigh;
    int waitTimeMs;

    //
    // algorithm: with critical focus already established prior to
    // this routine being called, we scan through the full +/- 20
    // AF tune range to find the range of values which produce
    // an immediate and consistent focus confirmation, then use
    // the midpoint of that confirmed range as the optimal AF tune value.
    //
    // when the scan starts we're looking for the first tune value
    // that produces an immediate and consistent focus confirmation;
    // that represents the low end of the confirmed range. once we
    // find that the scan is then looking for the first tune value
    // which fails to produce confirmation; that tune value minus 1
    // represents the high end of the confirmed range.
    //

    confirmedTuneRangeLow = confirmedTuneRangeHigh = TUNE_VALUE_INVALID;

    for (tuneValue=MIN_TUNE_VALUE; tuneValue<=MAX_TUNE_VALUE; tuneValue++) {

        //
        // set next AF tune value, allow time for PDAF to resample the
        // phase with the new AF TUNE value
        //
        set_afma(tuneValue, -1);
        msleep(AF_TUNE_CHANGE_SETTLE_TIME_MS);

        //
        // detect how long it takes for PD to sample a successful focus
        // confirmation. based on user-level observations, if there is
        // any perceptible delay between half-pressing the shutter and
        // getting the first focus confirmation then the focus confirmation
        // should be disregarded and the AF TUNE value not included in
        // the tuning range. since our logic is sampling an internal
        // firmware variable to detect focus confirmation, we would
        // need some way to "turn off" the camera's PD sensing so that
        // we can detect a fresh PD sensing transition akin to a half-press
        // of the shutter. if no such mechanism exists then our logic will
        // likely only be useful for AF tune changes that transition
        // from a non-confirmed to confirmed values (ie, when we're looking
        // for the high end of the range). if so, we might consider
        // changing the algorithm so that we start scanning from the opposite
        // end of the AF tune scale to find the high-end of the range
        //
        waitTimeMs = 0;
        do {
            if (is_focus_confirmed())
                break;
            msleep(10);
            waitTimeMs += 10;
        } while (waitTimeMs < MAX_TIME_TO_FIRST_FOCUS_CONFIRM_MS);

        if (waitTimeMs < MAX_TIME_TO_FIRST_FOCUS_CONFIRM_MS) {
            //
            // detected first focus confirmation within the time period
            // allowed. now make sure the focus confirmation stays
            // continuously on for our threshold before we consider
            // the current tune value part of the confirmed range
            //
            waitTimeMs = 0;
            do {
                if (!is_focus_confirmed())
                    break;
                msleep(10);
                waitTimeMs += 10;
            } while (waitTimeMs < MIN_CONTINUOUS_FOCUS_CONFIRM_TIME_MS);

            if (waitTimeMs >= MIN_CONTINUOUS_FOCUS_CONFIRM_TIME_MS) {
                //
                // focus remained confirmed for the duration we require, so
                // current AF tune value was confirmed to be part of the
                // confirmed range
                //
                if (confirmedTuneRangeLow == TUNE_VALUE_INVALID) {
                    // we just found the first end of the range (low end)
                    confirmedTuneRangeLow = tuneValue;
                    continue; // advance to next tune value to start searching high-end of range
                } else
                    //
                    // we've previously found the low end of the tune range and
                    // are trying to find the first non-confirmed tune
                    // value to establish the high-end of the range
                    //
                    continue; // advance to next tune value
            } // else focus confirmation failed to sustain for minimum time allowed
        } // else first focus confirmation didn't occur within max time allowed

        //
        // we reach this point if the current AF tune value is not confirmed
        //
        if (confirmedTuneRangeLow != TUNE_VALUE_INVALID) {
            //
            // we've previously found the low end of the tune range and now
            // found our first tune value which is non-confirmed, meaning
            // the high-end of the confirmed range is the current value
            // minus 1
            confirmedTuneRangeHigh = tuneValue-1;
            break; // done finding range; no more tune values to check
        }
    } // end of AF tune scan loop

    if (confirmedTuneRangeLow != TUNE_VALUE_INVALID && confirmedTuneRangeHigh != TUNE_VALUE_INVALID)
        //
        // DotTune successful. Optimal tune value is midpoint of range.
        // if the midpoint is between two whole values then we round down
        //
        return (confirmedTuneRangeHigh - confirmedTuneRangeLow)/2 + confirmedTuneRangeLow;

    if (confirmedTuneRangeLow == TUNE_VALUE_INVALID) {
        //
        // no AF tune values produced a confirmation, which likely
        // means critical focus was not properly achieved prior
        // to calling this routine
        //

        // show appropriate message to user
        ;
    } else {
        //
        // we found the low end of the range but +20 still produced a focus
        // confirmation, so the high end of the range is beyond +20, meaning
        // we can't find the precise midpoint
        //
       
        // show appropriate message to user
        ;
    }
    return TUNE_VALUE_INVALID; // indicate DotTune failed
}

Title: Re: DotTune AFMA
Post by: a1ex on February 22, 2013, 09:21:17 PM
1. Both. Sampling issue is actually something minor IMO.

2. It needs shutter pressed halfway (SW1).

3. The initial guess seems good.

The idea of waiting for continuous confirmation for 5 seconds is interesting, but in practice I don't think it will work (at least with my setup - 5D2 looking at some very small print). If the confirmation is strong, there are multiple focus beeps, and the dot blinks (but it's mostly on).

Also, camera's AF algorithm is not 100% reliable, so finding the range doesn't quite work. If the AF misses some spot in the middle of the range, the end point will be wrong. So, I prefer the current method, because it's much more statistically robust (even if it uses mean, not median).

I also have a problem when sometimes I get focus confirmations over the entire range. Not sure what it causes this, but changing micro AF in Canon menu seems to solve it. Probably the method I'm using for changing AF value isn't quite right.
Title: Re: DotTune AFMA
Post by: horshack on February 22, 2013, 10:45:37 PM
Quote from: a1ex on February 22, 2013, 09:21:17 PM
1. Both. Sampling issue is actually something minor IMO.

2. It needs shutter pressed halfway (SW1).

3. The initial guess seems good.

The idea of waiting for continuous confirmation for 5 seconds is interesting, but in practice I don't think it will work (at least with my setup - 5D2 looking at some very small print). If the confirmation is strong, there are multiple focus beeps, and the dot blinks (but it's mostly on).

Also, camera's AF algorithm is not 100% reliable, so finding the range doesn't quite work. If the AF misses some spot in the middle of the range, the end point will be wrong. So, I prefer the current method, because it's much more statistically robust (even if it uses mean, not median).

I also have a problem when sometimes I get focus confirmations over the entire range. Not sure what it causes this, but changing micro AF in Canon menu seems to solve it. Probably the method I'm using for changing AF value isn't quite right.

Thanks for the replies a1ex, much appreciated. Regarding the robustness of either approach, I think it's going to come down to how the behavior of the internal FOCUS_CONFIRMATION flag correlates to the VF confirmation behavior. If the flag matches the VF behavior, I think the negative-exclusion approach of my code snippet above would be necessary to produce a reliable midpoint/AF-tune value, at least based on feedback from the DotTune beta testers on the original FM thread. In particular, the lag to the initial confirmation and the sustaining of the confirmation without any dropouts were found to be critical for successful tuning, and these aspects might not be captured by a weighted, positive-only sampling of the confirmation, unless perhaps there were a very large number of samples over a long period of time. If however you find the flag behaves differently than the VF confirmation then that would certainly require a different approach to the programmatic implementation vs the user-lever method.

As for the ranging and midpoint method, that's been validated on both Nikon and Canon bodies and feedback indicates it's highly accurate with good precision/repeatability, again at least based on the user-level feedback provided by the VF. There shouldn't be nonlinearities or gaps in the confirmed range.
Title: Re: DotTune AFMA
Post by: a1ex on February 22, 2013, 10:54:44 PM
The confirmation flag matches the green dot, as far as I could tell.

But even with still camera and high-contrast test pattern, I couldn't get the dot steady for too long. Maybe it was because of artificial light (didn't try in daylight yet).

I'll try to figure it out for 5D3, so you can experiment with the algorithm.

Edit: works on 5D3, you can give it a try.
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 05:23:06 AM
Quote from: a1ex on February 22, 2013, 10:54:44 PM
The confirmation flag matches the green dot, as far as I could tell.

But even with still camera and high-contrast test pattern, I couldn't get the dot steady for too long. Maybe it was because of artificial light (didn't try in daylight yet).

I'll try to figure it out for 5D3, so you can experiment with the algorithm.

Edit: works on 5D3, you can give it a try.

Thanks again. I got the build environment set up and I'm able to compile the 5D3 autoexec.bin, albeit with a few compiler warnings which I assume are ok? Based on what I've pieced together from google searches, this is what I do:


Is that about it? And I just recopy new autoexec.bin and do fresh firmware updates to test each of my compiles? Anything else I should know?
Title: Re: DotTune AFMA
Post by: 1% on February 23, 2013, 06:45:56 AM
Figured it out for 6D, prop is different but old prop still there just dead.
Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 09:01:55 AM
Yes, the install procedure is correct. You need to run firmware update only once; after that, just copy the new autoexec.bin.
Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 10:28:45 AM
Just modified the algorithm, so it detects steady (strong) focus confirmations and scores them more (weak confirmation = 1, strong confirmation = 3).

Here's my typical score graph:

(http://a1ex.magiclantern.fm/bleeding-edge/afma.png)

Notice it looks kinda like a Gaussian curve with a bunch of outliers, and possibly some gaps in the middle. Currently, the only outlier filter is weight=score(i)^4, maybe median could work better.
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 10:55:55 AM
Thanks again for the help! Got alpha 3 installed and I'm able to test my own builds. My first task was to compare the programmatic check of the FOCUS_CONFIRMATION variable against the VF feedback and I'm excited to report they're essentially identical. The most critical aspect of DotTune is being able to distinguish confirmed vs non-confirmed values, which on Canon bodies involves very tight timing between the half-press and the first confirmation, along with a continuous confirmation without any dropouts (meaning multiple beeps/dot flickers). I have a particular lens + focus distance setup that causes both these scenarios to negative-confirm at one of the AF tune values and FOCUS_CONFIRMATION matched the VF behavior exactly. This gives me a lot of confidence that the programmatic negative-confirmation methodology will match the user-level DotTune success very well.

I have a few more questions...sorry :)

The 5D3 supports 2 tune values per lens, which is used for zoom lenses so you can tune at each end of the zoom range. It doesn't look like the ML tune property logic that was checked-in is aware of this. I was worried about that so for now I've commented out the programmatic AFMA-changing logic until I can be sure that the logic wont corrupt the NVRAM config on my 5D3. How do you usually go about reverse-engineering the property area, so that we can figure out the data structure for the new 2nd value?

What is the purpose of the "fake_simple_button(BGMT_INFO);" in the AFMA logic you wrote? I put it in my test routine and it cycles through a few info screens before getting to my logic. Is that used so that you have an active on-screen canvas to display messages on? (ie, the NotifyBox calls not work properly without the display being made active)

Regarding simulating a half-press of the shutter, I assume SW1(1,100) asserts a simulated press while SW1(0,100) deasserts it? Is the assign_af_button_to_halfshutter() before those necessary to associate that remote simulate to the shutter?

Thanks again,

Horshack
Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 11:21:38 AM
1. Didn't know that (my only AF lenses are 50/1.8 and 18-55 kit), but I've noticed two tune values that were changing together: AFMA_PER_LENS_A and AFMA_PER_LENS_B. So I just set both to the same value.

To find the offsets, I just print that buffer, change numbers in Canon menu and see what happens.

I've tried both per-lens and all-lenses adjustments on 5D3 (also turning the camera off in the middle of the process) and it's still alive. I don't think anyone else tried this on 5D3.

2. BGMT_INFO turns the display on.

3. assign_af_button_to_halfshutter disables the back-button AF, if set. Otherwise you won't get focus confirmation.
Title: Re: DotTune AFMA
Post by: discocalculi on February 23, 2013, 11:48:12 AM
Looks interesting. I got a few malfocusing lenses that might benefit from this. One had as strong malfocus as around -15/+15 on the Canon fine-tune, and when it got returned from the camera-shop service it pretty much acted the same.
Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 12:04:08 PM
I've also tried to expand the range to -40...40 and seems to work, the camera is still alive (5D2).

So, the theoretical range would be -127...127. Could this be useful?

If you try on other camera, try in C mode first, to prevent wrong settings being saved in NVRAM.
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 12:44:59 PM
Quote from: a1ex on February 23, 2013, 12:04:08 PM
I've also tried to expand the range to -40...40 and seems to work, the camera is still alive (5D2).

So, the theoretical range would be -127...127. Could this be useful?

If you try on other camera, try in C mode first, to prevent wrong settings being saved in NVRAM.

Absolutely this could be very useful. We'll need to see if the PDAF system itself actually supports these values. If it does this could help a lot of people whose tuning range exceeds +/-20.
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 12:54:35 PM
Here is my first DotTune under ML! Early indications are it's producing midpoints very close to the manual procedure. More testing is needed though. Also needs a nice UI if anyone is around who knows ML and is interested  :)



Here's the source:

#ifdef FEATURE_AFMA_TUNING
//
// Dot-Tune constants
//
#define AF_TUNE_CHANGE_SETTLE_TIME_MS        (10)   // time for PDAF to resample phase after changing AF tune (swag)
#define MAX_TIME_TO_FIRST_FOCUS_CONFIRM_MS   (300)  // max time we allow before 1st focus confirmation (swag)
#define MIN_CONTINUOUS_FOCUS_CONFIRM_TIME_MS (5000) // min time that focus confirmation must remain TRUE

int check_dottune_focus(void)
{

    int waitTimeMs;

    //
    // detect how long it takes for PD to sample a successful focus
    // confirmation. based on user-level observations, if there is
    // any perceptible delay between half-pressing the shutter and
    // getting the first focus confirmation then the focus confirmation
    // should be disregarded and the AF TUNE value not included in
    // the tuning range.
    //
    waitTimeMs = 0;
    do {
        if (FOCUS_CONFIRMATION)
            break;
        msleep(10);
        waitTimeMs += 10;
    } while (waitTimeMs < MAX_TIME_TO_FIRST_FOCUS_CONFIRM_MS);

    if (waitTimeMs >= MAX_TIME_TO_FIRST_FOCUS_CONFIRM_MS)
        // no initial focus confirmation within time period allowed
        return 0;

    //
    // detected first focus confirmation within the time period
    // allowed. now make sure the focus confirmation stays
    // continuously on for our threshold before we consider
    // the current tune value part of the confirmed range
    //
    waitTimeMs = 0;
    do {
        if (!FOCUS_CONFIRMATION)
            break;
        msleep(10);
        waitTimeMs += 10;
    } while (waitTimeMs < MIN_CONTINUOUS_FOCUS_CONFIRM_TIME_MS);

    if (waitTimeMs < MIN_CONTINUOUS_FOCUS_CONFIRM_TIME_MS)
        // focus dropped during continuous focus check
        return 0;

    //
    // focus remained confirmed for the duration we require, so
    // current AF tune value was confirmed to be part of the
    // confirmed range
    //
    return 1;
}


void afma_auto_tune()
{

    #define TUNE_VALUE_INVALID              (INT_MIN)
    #define MIN_TUNE_VALUE                  (-20)
    #define MAX_TUNE_VALUE                  (20)
 
    int tuneValue, focusConfirmed;
    int confirmedTuneRangeLow, confirmedTuneRangeHigh;

    int afma0 = get_afma(-1);
   
    msleep(1000);
   
    if (lv) { fake_simple_button(BGMT_LV); msleep(1000); }
   
    for (int i = 0; i < 5; i++)
    {
        if (!DISPLAY_IS_ON || !display_idle())
        {
            fake_simple_button(BGMT_INFO);
            msleep(500);
        }
    }

    if (lv) { NotifyBox(5000, "Turn off LiveView and try again."); beep(); return; }
    if (!DISPLAY_IS_ON || !display_idle()) { NotifyBox(5000, "Press " INFO_BTN_NAME " and try again."); beep(); return; }
    if (!is_manual_focus()) { NotifyBox(5000, "Switch to MF and try again."); beep(); return; }
    if (!lens_info.name[0]) { NotifyBox(5000, "Attach a chipped lens and try again."); beep(); return; }

#ifdef DONT_COMPILE_YET // wait until development is done before delaying on these msgs
    NotifyBox(5000, "You should have perfect focus.");
    msleep(2000);
    NotifyBox(5000, "Leave the camera still...");
    msleep(2000);
    NotifyBoxHide();
    msleep(100);
#endif
   
    assign_af_button_to_halfshutter();
    msleep(100);

    //
    // algorithm: with critical focus already established prior to
    // this routine being called, we scan through the full +/- 20
    // AF tune range to find the range of values which produce
    // an immediate and consistent focus confirmation, then use
    // the midpoint of that confirmed range as the optimal AF tune value.
    //
    // when the scan starts we're looking for the first tune value
    // that produces an immediate and consistent focus confirmation;
    // that represents the low end of the confirmed range. once we
    // find that the scan is then looking for the first tune value
    // which fails to produce confirmation; that tune value minus 1
    // represents the high end of the confirmed range.
    //
    confirmedTuneRangeLow = confirmedTuneRangeHigh = TUNE_VALUE_INVALID;

    for (tuneValue=MIN_TUNE_VALUE; tuneValue<=MAX_TUNE_VALUE; tuneValue++) {
       
        NotifyBox(1000, "Checking AF Tune %d", tuneValue);

        //
        // set next AF tune value to test, allow time for PDAF
        // to resample the phase with the new AF TUNE value
        //
        set_afma(tuneValue,-1);
        msleep(AF_TUNE_CHANGE_SETTLE_TIME_MS);

        //
        // check the focus at this AF tune value
        //
        SW1(1,100);
        focusConfirmed = check_dottune_focus();
        SW1(0,100);

        //
        // process focus result
        //
        if (focusConfirmed) { // focus confirmed for current tune value
            if (confirmedTuneRangeLow == TUNE_VALUE_INVALID) {
                // we just found the first end of the range (low end)
                confirmedTuneRangeLow = tuneValue;
                continue; // advance to next tune value to start searching high-end of range
            } else
                //
                // we've previously found the low end of the tune range and
                // are trying to find the first non-confirmed tune
                // value to establish the high-end of the range, so keep scanning
                //
                continue; // advance to next tune value
        } else  { // focus not confirmed for current tune value
            if (confirmedTuneRangeLow != TUNE_VALUE_INVALID) {
                //
                // we've previously found the low end of the tune range and now
                // found our first tune value which is non-confirmed, meaning
                // the high-end of the confirmed range is the current value
                // minus 1
                //
                confirmedTuneRangeHigh = tuneValue-1;
                break; // done finding range; no more tune values to check
            }
        }
    }
   
    restore_af_button_assignment();

    if (confirmedTuneRangeLow != TUNE_VALUE_INVALID && confirmedTuneRangeHigh != TUNE_VALUE_INVALID) {
        //
        // DotTune successful. Optimal tune value is midpoint of range.
        // if the midpoint is between two whole values then we round down
        //
        int midpoint = (confirmedTuneRangeHigh - confirmedTuneRangeLow)/2 + confirmedTuneRangeLow;
        set_afma(midpoint,-1);
        NotifyBox(5000, "Success: Mid=%d (range=%d..%d)",
                midpoint, confirmedTuneRangeLow, confirmedTuneRangeHigh);
        return;
    }

    //
    // DotTune failed
    //
    set_afma(afma0,-1); // restore orig AF tune value
    if (confirmedTuneRangeLow == TUNE_VALUE_INVALID)
        //
        // no AF tune values produced a confirmation, which likely
        // means critical focus was not properly achieved prior
        // to calling this routine
        //
        NotifyBox(5000, "Failed: Image is OOF!");
    else
        //
        // we found the low end of the range but +20 still produced a focus
        // confirmation, so the high end of the range is beyond +20, meaning
        // we can't find the precise midpoint
        //
        NotifyBox(5000, "Failed: +20 exceeded (low=%d)",
                confirmedTuneRangeLow);
}


Horshack
Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 01:43:44 PM
Very nice.

I've just added the extended AFMA ranges and they seem to work both on 5D2 and 5D3. They are interpreted properly in PDAF, you can try by defocusing a bit before running the calibration.

(http://a1ex.magiclantern.fm/bleeding-edge/afma-ext.png)

Now I'd like to compare both algorithms and see if there are any differences.
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 05:55:37 PM
Quote from: a1ex on February 23, 2013, 01:43:44 PM
Very nice.

I've just added the extended AFMA ranges and they seem to work both on 5D2 and 5D3. They are interpreted properly in PDAF, you can try by defocusing a bit before running the calibration.

(http://a1ex.magiclantern.fm/bleeding-edge/afma-ext.png)

Now I'd like to compare both algorithms and see if there are any differences.

The extended range support you added is going to be a godsend, not just for when the final AF tune value is beyond +/-20 but also when the DotTune range is beyond +/- 20 but where the midpoint still falls within +/- 20.

How should we go about comparing the algorithms? I have several lenses I could check yours on, but I'm thinking maybe the sample size would be too small. Should we consider leaving both algorithms in and make it user selectable?
Title: Re: DotTune AFMA
Post by: Greg on February 23, 2013, 06:35:18 PM
You can enter different values ​​for different AF points?
Example:
Left point: +3
Right point: +5
Title: Re: DotTune AFMA
Post by: Francis on February 23, 2013, 06:37:51 PM
I'm will test out the difference algorithms on my 5d2. I'm sure with a few more people from these forums we can get a decent sample size with a number of different lenses.
Title: Re: DotTune AFMA
Post by: 1% on February 23, 2013, 07:30:07 PM
The A and B values for per lens are W and T? They are set to the same thing? How to find both? The screen is supposed to shut off while its searching?

I get +13 on my 35-135. Have to try other leneses... wow, seems like a lot. My AF was off by this much on every picture?

-16 on tokina 11-16 in 16MM (designed for APS-C so 15+16 or you get vignette)
Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 07:36:38 PM
If the screen normally turns off when you press half-shutter, like 600D... not sure what to do. Maybe call display_on in the print routine?

With 5D3, I have +20 on 50/1.8 at ~1 meter and +8 at ~3 meters. Both figures are quite repeatable.
Title: Re: DotTune AFMA
Post by: 1% on February 23, 2013, 07:40:57 PM
So thats where its from. You can turn off screen off on half shutter in a function somewhere in canon menus.

I haven't been able to get a value outside of regular range yet. Its different at different distance? My distance calculation is broken.
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 07:54:19 PM
Quote from: a1ex on February 23, 2013, 07:36:38 PM
If the screen normally turns off when you press half-shutter, like 600D... not sure what to do. Maybe call display_on in the print routine?

With 5D3, I have +20 on 50/1.8 at ~1 meter and +8 at ~3 meters. Both figures are quite repeatable.

I just tried your latest. That GUI you put on it is so sweet. Here are the results with my Sigma 35mm f/1.4 @ 1.5 meters so far:

My algorithm: +6, +6, +5, +5
Your algorithm: +6, +5, +5, +5

So they look to be equal. I'll try a few more lenses - if they're all about the same then it looks like your algorithm is good to go! This is so cool.

Edit: Here are my 50mm EF f/1.4 results:

My algorithm: +3, +2, +2, +3
Your algorithm: +1, +2, +2, +2
Title: Re: DotTune AFMA
Post by: 1% on February 23, 2013, 08:02:39 PM
Tokina 50-150 says not enough info.

11-16 pointed outside now got +24 range.

600D has prop 0x80010006... will it just do nothing like turning on the level does?
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 10:18:55 PM
I've made a video to give others an early peak at this. The video is private right now - wanted to run it by you ML guys to make sure it's ok to make public.

Title: Re: DotTune AFMA
Post by: a1ex on February 23, 2013, 10:38:41 PM
Looks very nice, thanks a lot!

I would also like to include a screen which shows perfect focus on the test target (maybe the LiveView 10x screen). Of course, this is up to you.
Title: Re: DotTune AFMA
Post by: Greg on February 23, 2013, 10:45:44 PM
Quote from: 1% on February 23, 2013, 08:02:39 PM
600D has prop 0x80010006... will it just do nothing like turning on the level does?

I don't know anything about it. But I found it - http://magiclantern.wikia.com/wiki/AF_microadjust
Title: Re: DotTune AFMA
Post by: horshack on February 23, 2013, 10:53:59 PM
Quote from: a1ex on February 23, 2013, 10:38:41 PM
Looks very nice, thanks a lot!

I would also like to include a screen which shows perfect focus on the test target (maybe the LiveView 10x screen). Of course, this is up to you.

Thank YOU Alex! Having an in-camera automated AF tune is a remarkable achievement IMO. I suspect once this is becomes available many fresh users will give ML a serious look. Regarding prefocusing in LV, I make mention of it in the voice over, if that's ok for this initial video. When you guys release this officially I promise to do another video with better production value and more exposition, including the LV step.
Title: Re: DotTune AFMA
Post by: 1% on February 23, 2013, 11:03:27 PM
QuoteI don't know anything about it. But I found it - http://magiclantern.wikia.com/wiki/AF_microadjust

That prop will be all 0 on 600D, need offsets and lenght from 60D (closest camera) to compare. A lenght of 5 is a good start but I need to know where to put AFMA stuff and see if it follows it when actually focusing it. On 6D, using the wrong prop wrote correct values but nothing happened. I have no canon menu to check against on 600D. If 60D is also 5 then I can compare. 5d2 is like 1 off of 6D, 5d3 was a different prop.

*checked first value is 5 so that can't be mode. so its 1,2,3,4 I think without W+T that leaves 3/4. One is mode, others are all lens and per lens.
Title: Re: DotTune AFMA
Post by: Audionut on February 24, 2013, 01:02:48 AM
The general consensus is to test the MA @ 50x the focal length.  ie:  50mm lens @ 2.5M.

For general adjustments, the test should also be run with plenty of light from a good light source.
Although the Canon manual states that the adjustment should be made under the same shooting conditions.  So the ML implementation will fulfill this requirement nicely.

For Wide/Telle adjustments, I would just run 2 tests at both ends and make note of the results and enter manually.
Title: Re: DotTune AFMA
Post by: horshack on February 24, 2013, 05:54:14 AM
Was going to ask if you guys have unlocked the 60D's AFMA support but I just found the wiki. I don't have a 60D but I was wondering if the PDAF system internally supports AFMA.
Title: Re: DotTune AFMA
Post by: 1% on February 24, 2013, 06:13:42 AM
60D doesn't have afma in canon firmware? Fuuuck. Ok well for both then:

on 5d2 its
0x8
+4
and then the 2 values together so on 600D its likely: 1 and then 3,4? 60D that prop is the same length?

Not enough data
#define AFMA_MODE       afma_buf[0]
#define AFMA_PER_LENS   afma_buf[3]
#define AFMA_ALL_LENSES afma_buf[4]

not enough data
#define AFMA_MODE       afma_buf[0]
#define AFMA_PER_LENS   afma_buf[2]
#define AFMA_ALL_LENSES afma_buf[3]

Sometimes 0, sometimes not enough data, sometimes value
#define AFMA_MODE       afma_buf[0]
#define AFMA_PER_LENS   afma_buf[1]
#define AFMA_ALL_LENSES afma_buf[2]

Using other values for afma buf result in user canceled adjustment.
Title: Re: DotTune AFMA
Post by: Marsu42 on February 24, 2013, 11:55:02 AM
Quote from: 1% on February 24, 2013, 06:13:42 AM
60D doesn't have afma in canon firmware? Fuuuck.

Exactly - Canon removed it from the 50d->60d to make the 7d look better (thanks, Canon!). But probably all they did was commenting it out in the ui, so it would be a godsend it you'd figure out if the 60d internally still supports it...
Title: Re: DotTune AFMA
Post by: a1ex on February 24, 2013, 01:51:18 PM
Enabled it for 50D, no idea if it works: http://bitbucket.org/hudson/magic-lantern/commits/df1d8540749f

Who's brave enough to try?
Title: Re: DotTune AFMA
Post by: trsaunders on February 24, 2013, 02:50:55 PM
I just did a fresh checkout of the ML source, compiled and copied to camera, but I couldn't find the DotTune function. Do I need to enable something?

(http://i.imgur.com/1x9AR6X.png)

(http://i.imgur.com/DCPTkWE.png)
Title: Re: DotTune AFMA
Post by: a1ex on February 24, 2013, 03:17:03 PM
I forgot to enable FEATURE_AFMA_TUNING, try again.
Title: Re: DotTune AFMA
Post by: trsaunders on February 24, 2013, 03:43:08 PM
better luck this time, I could run DotTune, and my camera didn't catch on fire or explode but it didn't catch any focus like in the previous video.



I removed the sound track as there was lots of background noise, but at the end I switched to auto focus and took a photo and it focused fine. The camera was quite close to the subject though - not far off the minimum distance.
Title: Re: DotTune AFMA
Post by: a1ex on February 24, 2013, 04:05:20 PM
If you change AFMA value from ML menu, does the value get updated in Canon menu? Try in both modes (by-lens or all lenses).
Title: Re: DotTune AFMA
Post by: garry23 on February 24, 2013, 04:08:26 PM
trsaunders

You beat me to it: that is testing on the 50D.

However, although I downloaded the latest nightly build (23 Feb), for some reason I don't see the same ML start layout as you.

Strange?

Any idea why this should be?

Also, no AFA function.

Cheers

Garry
Title: Re: DotTune AFMA
Post by: trsaunders on February 24, 2013, 04:09:48 PM
Quote from: a1ex on February 24, 2013, 04:05:20 PM
If you change AFMA value from ML menu, does the value get updated in Canon menu? Try in both modes (by-lens or all lenses).
It does; I can set the 'all-lenses' value to 2 in ML, it is set as 2 in Canon. I change again in Canon menu, it is reflected in ML menu.

I can't see how to change between by-lens and all-lenses in the ML menu however?

Quote from: garry23 on February 24, 2013, 04:08:26 PM
Any idea why this should be?
you need to checkout and build the latest code
Title: Re: DotTune AFMA
Post by: a1ex on February 24, 2013, 04:12:54 PM
Nightly builds are updated daily, not every 10 minutes ;)

So... the AFMA part seems alright. Can you check if trap focus works?

Edit: also try on something with more contrast.
Title: Re: DotTune AFMA
Post by: trsaunders on February 24, 2013, 04:18:26 PM
ah ha, you're right, there was not enough contrast!

it works now  ;D
Title: Re: DotTune AFMA
Post by: Greg on February 24, 2013, 04:19:13 PM
Maybe the focus confirmation is not read?
Title: Re: DotTune AFMA
Post by: garry23 on February 24, 2013, 04:22:33 PM
All

As I don't build myself, I will wait for the next nightly build and add to trsaunders' testing, ie I have the following Canon lenses: 50mm, 100mm macro, 70-200 F4, plus I have 10-20 Sigma and 150-500 SAigma.

Cheers

Garry
Title: Re: DotTune AFMA
Post by: trsaunders on February 24, 2013, 04:26:41 PM
I'm not sure if the values are correct, it is giving me quite a large adjustment value (-12). Should I have just one focus point selected?
Title: Re: DotTune AFMA
Post by: Francis on February 24, 2013, 04:28:33 PM
Yes, just 1 focus point.
Title: Re: DotTune AFMA
Post by: garry23 on February 24, 2013, 04:40:15 PM
All

Once I manage to get the DotTune function up and running in my 50D I will cross check with the other AFA process I use, ie FocusTune.

I have found FocusTune to work well and it provides graphical plots that help provide confidence that you have indeed hit the sweet spot, ie it will be good to see DotTune and FocusTune align!

Cheers

Garry
Title: Re: DotTune AFMA
Post by: horshack on February 24, 2013, 05:55:49 PM
Quote from: Marsu42 on February 24, 2013, 11:55:02 AM
Exactly - Canon removed it from the 50d->60d to make the 7d look better (thanks, Canon!). But probably all they did was commenting it out in the ui, so it would be a godsend it you'd figure out if the 60d internally still supports it...

I'm thinking the same. Probably the easiest way to find out for sure is to enable DotTune for the 60D build and see if it finds any tune value between +/- 20 that doesn't produce focus confirmation, as this would imply the 60D's PDAF is using those values. This test assumes ML is using the correct NVRAM property location for the 60D's AF tune values.
Title: Re: DotTune AFMA
Post by: Marsu42 on February 24, 2013, 06:29:50 PM
Quote from: horshack on February 24, 2013, 05:55:49 PM
This test assumes ML is using the correct NVRAM property location for the 60D's AF tune values.

Indeed - but how to find them, if you cannot do anything afma'ish in the ui? I hope some dev with a lot of insight into the Canon property structures can either give it a try so we can put out hopes to rest :-\
Title: Re: DotTune AFMA
Post by: 1% on February 24, 2013, 07:00:32 PM
Its a little bit of a dead end on 600D as nothing wants to enable the property. If 60D property is also 5 then we have to look elsewhere. I did see the graph and it did come up with a value a few times but no way to keep it enabled.
Title: Re: DotTune AFMA
Post by: horshack on February 25, 2013, 05:51:18 AM
Alex,

I've been tied up this weekend but I'm getting back to this for more testing. Q about the current algo - I noticed your two focus loops continue to execute even after detecting FOCUS_CONFIRMATION. Is this done intentionally for downstream timing, because I can't see any other side effect otherwise. If I insert a break after FOCUS_CONFIRMATION I get the same tune results and shave about 30 seconds off the DotTune time, dropping from 1:47 to 1:18 for a range that has about 20 tune units.

Here's the modified source (change in red):

// check for focus confirmation
            int fc = 0;
            for (int j = 0; j < 20; j++)
            {
                msleep(10);
                if (FOCUS_CONFIRMATION) {
                    fc = 1;
                    break;
                }
            }
           
            // weak or strong confirmation? use a higher score if strong
            if (fc)
            {
                msleep(500);
                for (int j = 0; j < 20; j++)
                {
                    msleep(10);
                    if (FOCUS_CONFIRMATION) {
                        fc = 3;
                        break;
                    }
                }
            }

Thanks,

Horshack
Title: Re: DotTune AFMA
Post by: eolia on February 25, 2013, 11:35:27 AM
Where can we get the nighty to help debug ?
Title: Re: DotTune AFMA
Post by: a1ex on February 25, 2013, 02:07:45 PM
Click on Download.

@horshack: correct, the focus loops don't have to keep executing, as the msleep(100) before the first loop is enough.

You may also want to review this: https://bitbucket.org/hudson/magic-lantern/commits/6334a26c16a9
Title: Re: DotTune AFMA
Post by: horshack on February 26, 2013, 10:06:46 AM
Alex,

That change looks good. I haven't tested the expanded ranges yet; if for whatever reason those don't work out we might want to replace the user suggestion of trying a wider range with a warning message that the new tune value may not be reliable since -20 or +20 were part of the range.

Today I spent about an hour on the core timing of the focus confirmation detection, comparing it to my own visual AF confirmation checks. Rather than just verifying the final calculated value like I was before, today I was comparing the behavior of individual tune values at the periphery of the tuning range. Your algo vs my visual check matches well; your idea to do 4 sweeps is perfect because I do see a blip on one or two passes so the 4 passes is just right for normalizing them out.

The only worthwhile improvement I found was to change to 500ms dead delay into a continuous FOCUS_CONFIRMATION check; right now the code is waiting 500ms and then sampling in a separate loop, which misses some multiple-beep/confirmation cases I see at the outliers on my 50mm f/1.4 (ie, tune values that should be discarded but are included). So rather than sampling for one positive confirmation after 500ms it catches more blips if we sample continuously.

Here's the proposed change. Since this change involves another sampling loop I consolidated that into a separate nested function. Let me know what you think...

    SW1(1,100);

    int wait_for_focus_confirmation_val(int maxTimeToWaitMs, int valToWaitFor)
    {
        int timeWaitedMs = 0;
        for ( ;; )
        {
            if (FOCUS_CONFIRMATION == valToWaitFor)
                return 1; // detected value
            if (timeWaitedMs >= maxTimeToWaitMs)
                return 0; // timed-out before detecting value
            msleep(10);
            timeWaitedMs += 10;
        }
    }

    for (int k = 0; k < 2; k++)
    {
        for (int c = 0; c <= 80; c++) // -20 ... 20 and back to -20
        {
            int i = (c <= 40) ? c-20 : 60-c;
            set_afma(i * range_expand_factor, AFMA_MODE_AUTODETECT);
            msleep(100);
           
            int fc;
            // initial focus must occur within 200ms
            fc = wait_for_focus_confirmation_val(200, 1);
           
            if (fc)
            {
                // weak or strong confirmation? use a higher score if strong
                // focus must sustain for 500ms to be considered strong
                if (!wait_for_focus_confirmation_val(500, 0))
                    // focus sustained
                    fc = 3;
            }
           
            score[i+20] += fc;
            afma_print_status(score, range_expand_factor);
           
            if (!HALFSHUTTER_PRESSED)
            {
                beep();
                set_afma(afma0, AFMA_MODE_AUTODETECT);
                NotifyBox(2000, "Canceled by user.");
                return;
            }
        }
    }
    SW1(0,100);

Thanks,

Horshack
Title: Re: DotTune AFMA
Post by: horshack on March 02, 2013, 08:59:25 PM
Alex,

I added logic for the 5DM3's unique wide/tele AFMA support. The source is below. When DotTuning a zoom and specifying a wide vs tele value (instead of "both"), the user needs to make sure he sets his lens focal length to match where he'll be storing his wide/tele tune value before starting the DotTune, because otherwise the 5DM3's firmware will interpolate AF tune values between the wide and tele settings and this is not desirable when tunning. For example, when focusing (or evaluating focus via the VF confirmation), if AFMA is -5 for wide and -10 for tele on a 70-200mm lens, @ 70mm the 5DM3 firmware will use -5, @ 200mm it will use -10, and for any focal length in between it will use a scaled value between -5 and -10, per Canon's 5DM3 manual and my observations as well.

Here's the source. Again I'm new to ML so this might require some modification as you see fit. Thanks!

src/dryos.h:
/** AF microadjustment **/
int get_afma(int mode, int focalVal);
void set_afma(int value, int mode, int focalVal);
#define AFMA_MODE_AUTODETECT -1
#define AFMA_MODE_DISABLED 0
#define AFMA_MODE_ALL_LENSES 1
#define AFMA_MODE_PER_LENS 2
#define AFMA_FOCAL_VAL_BOTH 0
#define AFMA_FOCAL_VAL_WIDE 1
#define AFMA_FOCAL_VAL_TELE 2


platform/5D3 cfn.c:
// 5D3 only; other cameras have different offsets, buffer size etc
#define PROP_AFMA_CFN 0x80040027
static int8_t afma_buf[0x10];
#define AFMA_MODE          afma_buf[0x0]
#define AFMA_PER_LENS_WIDE afma_buf[0x2]
#define AFMA_PER_LENS_TELE afma_buf[0x3]
#define AFMA_ALL_LENSES    afma_buf[0x5]

int get_afma(int mode, int focalVal)
{
    if (mode == AFMA_MODE_AUTODETECT) mode = AFMA_MODE;
   
    if (mode == AFMA_MODE_PER_LENS)
        // for AFMA_FOCAL_VAL_BOTH, return AFMA_PER_LENS_WIDE
        return (focalVal <= AFMA_FOCAL_VAL_WIDE ? AFMA_PER_LENS_WIDE : AFMA_PER_LENS_TELE);

    else if (mode == AFMA_MODE_ALL_LENSES)
        return AFMA_ALL_LENSES;

    return 0;
}

void set_afma(int value, int mode, int focalVal)
{
    if (ml_shutdown_requested) return;

    value = COERCE(value, -AFMA_MAX, AFMA_MAX);

    if (mode == AFMA_MODE_AUTODETECT) mode = AFMA_MODE;
    if (mode == AFMA_MODE_DISABLED) mode = AFMA_MODE_ALL_LENSES;
   
    if (mode == AFMA_MODE_PER_LENS) {
        if (focalVal == AFMA_FOCAL_VAL_BOTH)
            AFMA_PER_LENS_WIDE = AFMA_PER_LENS_TELE = value;
        else if (focalVal == AFMA_FOCAL_VAL_WIDE)
            AFMA_PER_LENS_WIDE =  value;
        else if (focalVal == AFMA_FOCAL_VAL_TELE)
            AFMA_PER_LENS_TELE = value;
        else return; // bad arguments
    }
   
    else if (mode == AFMA_MODE_ALL_LENSES)
        AFMA_ALL_LENSES = value;
   
    else return; // bad arguments
   
    AFMA_MODE = mode;
    prop_request_change(PROP_AFMA_CFN, afma_buf, sizeof(afma_buf));
}


platform/5D2 cfn.c:
int get_afma(int mode, int focalVal /* not supported on 5D2 */)
{
    if (mode == AFMA_MODE_AUTODETECT) mode = AFMA_MODE;
   
    if (mode == AFMA_MODE_PER_LENS)
        return AFMA_PER_LENS;

    else if (mode == AFMA_MODE_ALL_LENSES)
        return AFMA_ALL_LENSES;

    return 0;
}

void set_afma(int value, int mode, int focalVal /* not supported on 5D2 */)
{
    if (ml_shutdown_requested) return;

    value = COERCE(value, -AFMA_MAX, AFMA_MAX);

    if (mode == AFMA_MODE_AUTODETECT) mode = AFMA_MODE;
    if (mode == AFMA_MODE_DISABLED) mode = AFMA_MODE_ALL_LENSES;

    if (mode == AFMA_MODE_PER_LENS)
        AFMA_PER_LENS = value;
   
    else if (mode == AFMA_MODE_ALL_LENSES)
        AFMA_ALL_LENSES = value;
   
    else return; // bad arguments

    AFMA_MODE = mode;
    prop_request_change(PROP_AFMA_CFN, afma_buf, sizeof(afma_buf));
}


src/focus.c:
#ifdef FEATURE_AFMA_TUNING

CONFIG_INT( "focal_afma_value_select", focal_afma_value_select, AFMA_FOCAL_VAL_BOTH);

static void afma_print_status(int8_t* score, int range_expand_factor)
{

Changed all get_afma() and set_afma() calls in focus.c to pass "focal_afma_value_select" as final argument, which includes afma_print_status(), afma_auto_tune(), MENU_UPDATE_FUNC(afma_display), and MENU_SELECT_FUNC(afma_toggle)

            {
                .name = "AF microadjust",
                .update = afma_display,
                .select = afma_toggle,
                #ifdef CONFIG_AFMA_EXTENDED
                .help  = "Adjust AFMA value manually. Range: -100...+100.",
                #else
                .help  = "Adjust AFMA value manually. Range: -20...+20.",
                #endif
                .edit_mode = EM_MANY_VALUES,
            },
#if defined(CONFIG_5D3)
            {
                .name = "Wide/Tele Select",
                .priv = &focal_afma_value_select,
                .max = 2,
                .choices = (const char *[]) {"Both/Prime", "Wide(Zoom)", "Tele(Zoom)"},
                .help = "Body supports two AFMA values for zoom lenses.",
            },
#endif
            MENU_EOL
        },
    },
};



Title: Re: DotTune AFMA
Post by: pulsar124 on March 02, 2013, 09:30:16 PM
Thanks for the efforts - fantastic project! I just wish one day you will figure out how to make MFA values FL and/or distance dependent.

I gave a try to the nightly built on my 50D, and happy to report that it seems to be working fine. I will do more thorough testing with good light and target, comparing ML/dot-tune results to FoCal results, on my fast lenses (135mm f2.0, 17-50mm f2.8, 70-200mm f4).
Title: Re: DotTune AFMA
Post by: 1% on March 02, 2013, 10:42:56 PM
Great! 6D has wide/tele too. Saves me from doing 2 tests like was suggested earlier.
Title: Re: DotTune AFMA
Post by: Jansten on March 03, 2013, 02:33:06 AM
Can this be implented in the apha 3 for the 7d?
I know 7d have only one micropoint for adjustment, but you guys have sorted out that already, I understood
It would be great not to use lens- align to calibrate the lens i own
And Just use the Dot-tune feature

Keep up the good work :)
Title: Re: DotTune AFMA
Post by: g3gg0 on March 03, 2013, 01:02:46 PM
it will be in alpha 3
Title: Re: DotTune AFMA
Post by: a1ex on March 03, 2013, 01:19:14 PM
Just did a slightly bigger change: besides adding support for wide/tele adjustments, I've moved all AFMA code to afma.c and kept only the constants in platform directory (afma.h).

So... it needs some testing to make sure I didn't break anything.
Title: Re: DotTune AFMA
Post by: 1% on March 03, 2013, 04:39:57 PM
Menu parts work so far. Going to have to try the adjustments. I think we still have to manually register the lens if we want to use per lens? Only other improvement I can think of.
Title: Re: DotTune AFMA
Post by: Francis on March 03, 2013, 06:15:42 PM
I have a 100mm macro lens that I use both for macro shots and for portraits. Running DotTune at both a macro and a portrait distance gives different results (-5 at portrait, +4 at macro). Sound I use the average? 0 and -1 lies in the acceptable range for both. Does that sound reasonable or am I missing something? The author suggests 50 x focal length. I almost never use this lens at 5m so it doesn't seem appropriate to set the MA at that distance.
Title: Re: DotTune AFMA
Post by: rktaylor on March 04, 2013, 01:26:47 AM
I'm new at this but if I understand correctly this will auto calibrate my lenses with the proper AFMA and adjust appropriately in my C.FnII: Autofocus settings for each lens ... correct?

Here are the steps I followed with all four (see below for my lenses) I own.

1.  Good Lighting
2.  Set to manual focus
3.  Focus on high contrast subject ... in my case I used a focus graph found on internet
4.  Go to DotTurne and scan with default (-20...+20)
5.  Ran through testing

the results was Zero with all of my lenses ... does that seem right?
If I did get an adjustment would it auto recognize the lenses attached and use the appropriate adjustment.

As you can see below my camera is a Canon 6D

Thanks
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 04:00:53 AM
Quote from: a1ex on March 03, 2013, 01:19:14 PM
Just did a slightly bigger change: besides adding support for wide/tele adjustments, I've moved all AFMA code to afma.c and kept only the constants in platform directory (afma.h).

So... it needs some testing to make sure I didn't break anything.

Thanks Alex. Works fine on my 5DM3. The only new issue I found is if the user cancels or DotTune ends in error, the final call to set_afma(afma0, afma_mode) will fail to properly restore the original tune value when afma_mode is AFMA_MODE_PER_LENS, since get_afma(AFMA_MODE_PER_LENS) returns the midpoint of the wide/tele settings for #CONFIG_AFMA_WIDE_TELE builds:

return (AFMA_PER_LENS_WIDE + AFMA_PER_LENS_TELE) / 2;

The logic in afma_auto_tune() will need to save off and restore both wide/tele values for the user cancelled/DotTune failed case.

I'm also thinking we might want to consider removing the "both" mode for #CONFIG_AFMA_WIDE_TELE builds and instead force the user to always set wide or tele. This is based on my reading on the 5DM3 manual - when only a single value is configured (wide or tele), the camera will still scale that tune value for other focal lengths on the zoom, and so having the wide+tele set to the same tune value might not be ideal for the majority of users, even if it would be useful for a small percentage of them.
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 04:03:59 AM
Quote from: Francis on March 03, 2013, 06:15:42 PM
I have a 100mm macro lens that I use both for macro shots and for portraits. Running DotTune at both a macro and a portrait distance gives different results (-5 at portrait, +4 at macro). Sound I use the average? 0 and -1 lies in the acceptable range for both. Does that sound reasonable or am I missing something? The author suggests 50 x focal length. I almost never use this lens at 5m so it doesn't seem appropriate to set the MA at that distance.

It's not unsual for lenses to exhibit focus-distance variance in tune values. You can either choose the value for a single distance if that's what you shoot at most often, or use the midpoint of the distance values if that produces acceptable results for you.
Title: Re: DotTune AFMA
Post by: 1% on March 04, 2013, 04:05:59 AM
Should not be 0 on most lenses. Canon menu -> lcd on/off remains on. What happens with the squares? I just ran on tokina 11-16 again in less than perfect focus and got +11.

So what happens with all lenses? Doesn't scale?
Title: Re: DotTune AFMA
Post by: rktaylor on March 04, 2013, 06:19:06 AM
Quote 1%:

Should not be 0 on most lenses. Canon menu -> lcd on/off remains on. What happens with the squares? I just ran on tokina 11-16 again in less than perfect focus and got +11.

So what happens with all lenses? Doesn't scale?


Sorry very busy time of the year for me and have not had time to figure out the quote option ... but ...

If you are referring to the 'Live view Shoot' option it is enabled.

The squares (for all four lenses) are successful (large boxes) all the way across the screen both ways ... I'm sure I'm not doing something right.  Under the AFMA mode I've tested only for 'This Lens' and have not run the test for 'All Lenses'.  I'm not sure what you mean about 'Doesn't scale'.

When I have a spare time I'll continue testing.  Thanks for the response.
Title: Re: DotTune AFMA
Post by: a1ex on March 04, 2013, 03:38:47 PM
For prime lenses, the 5D3 uses the wide adjustment (and ignores the tele one).
Title: Re: DotTune AFMA
Post by: 1% on March 04, 2013, 04:05:29 PM
But is "all lenses" scaled across focal length too? Lots of little quirks it seems.
Title: Re: DotTune AFMA
Post by: Audionut on March 04, 2013, 04:47:04 PM
Quote from: 1% on March 04, 2013, 04:05:29 PM
But is "all lenses" scaled across focal length too?

My understanding is that option sets a consistent AFMA.  ie:  it always adjusts by that amount regardless. 

Just a way of adjusting for the body itself imo.
Title: Re: DotTune AFMA
Post by: 1% on March 04, 2013, 05:00:42 PM
Will have to test a bunch of lenses at correct lighting/FL and see what happens. Have to pull the newest commit.

I only got 0 on one lens, tokina 50-150 aiming outside.
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 05:18:12 PM
Quote from: 1% on March 04, 2013, 04:05:29 PM
But is "all lenses" scaled across focal length too? Lots of little quirks it seems.
Not sure, but I would think yes (for zooms).

Another curious question is how Canon's firmware handles a per-lens wide/tele value of 0. The 5DM3 manual says firmware will scale for zooms even if only the wide or tele tune value is set...so how does their firmware distinguish a user-specific tune value of 0 vs a non-set (unassigned) tune value, which is also represented as zero in the menu? Would seem they would need an assigned/unassigned bit somewhere, otherwise the firmware would always scale on the "non-configured" end to 0, which should be quite different than scaling when both the wide/tele are set to identical values. Based on these uncertainties I would strongly suggest owners to always tune both the wide and tele ends.
Title: Re: DotTune AFMA
Post by: 1% on March 04, 2013, 05:31:59 PM
Maybe need to find out where the actual value ends up in the FW besides the property.
Title: Re: DotTune AFMA
Post by: pulsar124 on March 04, 2013, 05:57:23 PM
I just did fairly comprehensive testing of dot-tune/ML on my 50D, using  magiclantern-v2.3.NEXT.2013Mar02.60D.550D.600D.50D.500D.5D2.1100D.zip. The results are reported here:

http://photography-on-the.net/forum/showthread.php?t=1280584

In particular,

Quote- ML implementation of dot-tune is not perfect yet - at the edges of the good interval, I could see the delay in AF confirm light, sometimes double beep (all these should be discarded according to the Dot-tune author, but ML would apparently still consider them okay, and count them in). Meaning - you can do slightly better if instead of using ML, just do dot-tune manually. But I am sure this will be addressed quickly in the future releases of ML.
Title: Re: DotTune AFMA
Post by: a1ex on March 04, 2013, 06:01:15 PM
These values are still considered, but they have a much lower weight. So, if your lighting conditions or contrast are poor, it will still work.
Title: Re: DotTune AFMA
Post by: pulsar124 on March 04, 2013, 06:05:09 PM
Thanks - but wouldn't lower weight be reflected in shorter bars in the MFA progress diagram? When I get less-than-good AF confirmation, I can still see the bar having the same height as for good MFA values.
Title: Re: DotTune AFMA
Post by: a1ex on March 04, 2013, 06:12:02 PM
Didn't notice this...
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 06:24:14 PM
Quote from: pulsar124 on March 04, 2013, 05:57:23 PM
I just did fairly comprehensive testing of dot-tune/ML on my 50D, using  magiclantern-v2.3.NEXT.2013Mar02.60D.550D.600D.50D.500D.5D2.1100D.zip. The results are reported here:

http://photography-on-the.net/forum/showthread.php?t=1280584

In particular,

Thanks for your observations, they're greatly appreciated.

Regarding ML's DotTune and how it may sometimes miss the multiple confirmations  for the outlier tune value values, there are two possible strategies at work here, one which is used by the manual DotTune process and one used by ML's DotTune.

In the manual process the user is instructed to hold AF for 5 seconds, which catches > 90% of the multiple AF confirmations that should be excluded from the tuning range. This strategy is important because the manual techique is based around a decisive determination of indivudal tune values in a "single pass".

The second strategy, which is used by ML, is to decrease the sampling duration but increase the sampling frequency. Instead of waiting 5 seconds to detect multiple confirmations at each tune value, ML waits for only 500ms (1/2 second). But ML does 4 "sweeps" (passes), which means 4 500ms samples, for a total of 2.5 seconds of sampling. Multiple-confirmations occur at irregular intervals into an AF hold, so a tune value may produce multi-confirmations at 3 seconds into the AF hold on one sample but at only 300ms into another. In practice it roughly works out to about the same, and because ML's DotTune uses a weighted algorithm for the final tune value determination, it will properly demote tune values which had one or more multiple-confirmation samples relative to values which had no multiple-confirmation samples. That's not to say ML will not sometimes fail to exclude a tune value that a thorough manual DotTune would otherwise catch. There's always room for improvement. It's a balance between expediency and accuracy. ML DotTune could increase the sampling duration to catch maybe 30-50% more multiple-confirmations per sweep, but with 4 samples it wont affect the final result in the majority of DotTune cases.
Title: Re: DotTune AFMA
Post by: pulsar124 on March 04, 2013, 06:28:31 PM
Thanks for the detailed response! But this begs a suggestion - would it be possible to let the user choose both the number of passes and the duration of one measurement, from the ML menu?
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 06:39:18 PM
Quote from: pulsar124 on March 04, 2013, 06:28:31 PM
Thanks for the detailed response! But this begs a suggestion - would it be possible to let the user choose both the number of passes and the duration of one measurement, from the ML menu?
I've considered that, exposing the low-level algorithm parameters to the user in the menu. It would be up to Alex. There would actually be three parameters:

1) Total number of passes
2) Maximum period allowed (ms) before first AF confirmation must occur. This is to catch delayed confirmations that should be excluded. This is currently hard-coded at 200ms
3) Minimum period (ms) that AF confirmation must sustain without any dropouts. This is to catch multiple confirmations that should be excluded. This is currently hard-coded at 500ms.

Instead of exposing these parameters it might be more user-friendly to define a "Fast" vs "Slow" option, the former using the current thresholds and the latter using expanded thresholds.
Title: Re: DotTune AFMA
Post by: pulsar124 on March 04, 2013, 07:46:36 PM
Either way, that would be an improvement. More power to users is always a good thing!
Title: Re: DotTune AFMA
Post by: a1ex on March 04, 2013, 07:48:51 PM
QuoteMore power to users is always a good thing!

(http://www.e1.ru/fun/photo/view_pic.php/p/0b8ade395a836912f985b363e3fd8f59/view.pic)

;)

[source] (http://www.magiclantern.fm/forum/index.php?topic=4386.msg27793#msg27793)
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 07:57:44 PM
Another benefit of exposing the raw parameters is that it can help with debugging any body/lens-specific ML DotTune issues.
Title: Re: DotTune AFMA
Post by: horshack on March 04, 2013, 11:00:26 PM
Alex, here is logic that can make the algo parameters tunable if you'd like to go that route. I couldn't get a submenu-within-a-submenu working so these options are at the same menu level as the others:

top of module:
static CONFIG_INT( "dottune.number_scans", dottune_number_scans, 2);
static CONFIG_INT( "dottune.max_time_10ms_initial_af_confirm", dottune_max_time_10ms_initial_af_confirm, 200/10);
static CONFIG_INT( "dottune.min_time_10ms_sustain_af_confirm", dottune_min_time_10ms_sustain_af_confirm, 500/10);

// we have to wait until the AFMA change is operated into Canon firmware
static int afma_ack = 0;


afma_auto_tune():
    SW1(1,100);

    for (int k = 0; k < dottune_number_scans; k++)
    {
        for (int c = 0; c <= 80; c++) // -20 ... 20 and back to -20
        {
            int i = (c <= 40) ? c-20 : 60-c;
            set_afma(i * range_expand_factor, afma_mode);
            msleep(100);
           
            int fc;
            // initial focus must occur within quick period to exclude AF confirm lags
            fc = wait_for_focus_confirmation_val(dottune_max_time_10ms_initial_af_confirm*10, 1);
           
            if (fc)
            {
                // weak or strong confirmation? use a higher score if strong
                // focus must sustain for long period be considered strong
                if (!wait_for_focus_confirmation_val(dottune_min_time_10ms_sustain_af_confirm*10, 0))
                    // focus sustained
                    fc = 3;
            }           
           
            score[i+20] += fc;
            afma_print_status(score, range_expand_factor);
           
            if (!HALFSHUTTER_PRESSED)
            {
                beep();
                set_afma(afma0, afma_mode);
                NotifyBox(2000, "Canceled by user.");
                return;
            }
        }
    }
    SW1(0,100);


Bottom of module:
static MENU_UPDATE_FUNC(dottune_max_initial_af_confirm)
{
    MENU_SET_VALUE("%d ms", dottune_max_time_10ms_initial_af_confirm * 10);
}
static MENU_UPDATE_FUNC(dottune_min_sustain_af_confirm)
{
    MENU_SET_VALUE("%d ms", dottune_min_time_10ms_sustain_af_confirm * 10);
}

static struct menu_entry afma_menu[] = {


And added menu options:
            {
                .name = "AFMA mode",
                .priv = &afma_mode_index,
                .select = afma_mode_toggle,
                .min = 0,
                #ifdef CONFIG_AFMA_WIDE_TELE
                .max = 3,
                #else
                .max = 2,
                #endif
                .choices = CHOICES(
                    "Disabled",
                    "All lenses",
                    #ifdef CONFIG_AFMA_WIDE_TELE
                    "This lens, wide/prime",
                    "This lens, tele"
                    #else
                    "This lens"
                    #endif
                ),
                .help  = "Where to apply the AFMA adjustment.",
                .icon_type = IT_DICE_OFF,
            },
            {
                .name = "No. range scans",
                .priv = &dottune_number_scans,
                .min = 1,
                .max = 99,
                .help  = "Larger values increase sample size.",
            },
            {
                .name = "Max 1st AF confirm(ms)",
                .priv = &dottune_max_time_10ms_initial_af_confirm,
                .min = 10/10,       /* 10ms */
                .max = 10000/10,    /* 10 seconds */
                .update = dottune_max_initial_af_confirm,
                .help  = "Smaller values are more discerning.",
            },
            {
                .name = "Min cont AF confirm(ms)",
                .priv = &dottune_min_time_10ms_sustain_af_confirm,
                .min = 10/10,       /* 10ms */
                .max = 30000/10,    /* 30 seconds */
                .update = dottune_min_sustain_af_confirm,
                .help  = "Larger values are more discerning.",
            },
            MENU_EOL,
        },
    },
};
Title: Re: DotTune AFMA
Post by: rktaylor on March 05, 2013, 07:24:42 AM
I just recently re-ran the test form my 50mm 1.4 lens using All Lenses and got an AF microadjust of -1 ... does that mean it will adjust all of my lenses by -1?  I also went into the C.FnII:Autofocus Canon Menu and I can see where it adjusted 'All by the same amount.  Should I go into 'Adjust by Lens' to customize it per lens?

Thanks ... just trying to understand the process.
Title: Re: DotTune AFMA
Post by: 1% on March 05, 2013, 08:24:02 AM
Yes, it will adjust all lenses. Also when using individual lens adjustments register lens first in canon menu. There is another value in the property that changes when this happens and I don't think afma is accounting for it.
Title: Re: DotTune AFMA
Post by: Marsu42 on March 05, 2013, 08:41:18 AM
Quote from: pulsar124 on March 04, 2013, 07:46:36 PM
More power to users is always a good thing!

(http://img715.imageshack.us/img715/2725/vaderh.png)

:-p
Title: Re: DotTune AFMA
Post by: 1% on March 05, 2013, 10:39:55 PM
Mainly folks need to read & research. I try... sometimes excitement gets the best of me and I end up with more problems at the end, not to much for ML but other stuff I jump into. Like a new platform (android/wrt), etc.
Title: Re: Roger Cicala at LensRentals might be willing to help test
Post by: l_d_allan on March 12, 2013, 11:51:38 AM
Roger Cicala is the founder of LensRentals, and very knowledgeable about MFA. LensRentals has dozens (hundreds?) of cameras and thousands of lenses. He might be willing to get involved in testing automated MFA. I'll check with him.
Title: Re: [DONE] DotTune AFMA
Post by: jpc82 on March 13, 2013, 04:08:13 PM
This is great, and amazing work.  I feel another donation coming ML's way.  This will be a time saver for sure when testing lenses, especially if I buy a new lens.
Title: Re: [DONE] DotTune AFMA
Post by: hjulenissen on March 17, 2013, 10:45:46 AM
I cant wait to try this out in my 7D when alpha 3 arrives.

Are you guys aware of this application:
http://www.reikan.co.uk/focalweb/

They now can do calibration without flicking the mirror per shot.

They also publish statistics (based on automated user reports) on different lens/house combinations:
http://www.reikan.co.uk/focalweb/index.php/online-tools/lenscamera-information/

I have used it a lot, and I have come to the conclusion that AFMA is difficult. My 70-200 needs one AFMA setting at 120mm or so, another setting at the ends (meaning that even a 5Dmk3 would have to few parameters). The choice of defocusing method ("near" or "far") seems to have some significance sometimes, with some lenses. I have done extensive testing, saying to my self "now everything is as good as it can be", only to repeat under slightly different conditions and getting equally conclusive measurements pointing in another direction...

-h
Title: Re: [DONE] DotTune AFMA
Post by: HugoFilipe on March 17, 2013, 01:58:22 PM
How can i load it on a 5D3 as shown in the video?
Nightly builds shows only the 2.3 supported cameras.

Thanks in advance!
Title: Re: [DONE] DotTune AFMA
Post by: msadat on March 22, 2013, 11:29:42 PM
my first post here, thx much for implementing this feature,

i have load my 5dii with the regular build and then loaded the latest nightly build,

i am running into trouble running the AFMA option. i focus manually using the 10x, set the lens to manual focus and choose the menu option -20 +20 and the info screen comes up, blinks couple times and it says repeat the process again and stays in that loop, what i am doing wrong?
Title: Re: [DONE] DotTune AFMA
Post by: a1ex on March 22, 2013, 11:49:43 PM
Enable Canon info screen.
Title: Re: [DONE] DotTune AFMA
Post by: msadat on March 24, 2013, 03:46:10 AM
thx alex that worked, now i see if i can get consistent set of number for sigma 50mm 1.4 and canon 85mm 1.2
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 24, 2013, 11:56:35 PM
I have a 5D Mk II running v2.3.NEXT.2013Mar19 

While running Dot Tune AFMA with my 70-200mm 2.8 IS II, I would sometimes get a bug: Each and every MA box would light up  during the test on all 4 passes. (even with -100..+100 selected). This would result in a new AFMA of "0" and an Error message "Double-check the focus target".  This would happen a few times in a row. Changing Focus Targets, distance, and lighting, had no effect. I would then exit the program, reboot the camera, and try various other things until it went away.  This only happened a few times and I am not even sure how I was able to correct it.

Any thoughts on what was going on?

SOLVED...  Before running Dot Tune AFMA, go into the Canon AFMA menu and set a random MA value for the lens before you run ML Dot Tune AFMA. If you don't you may get the type of error I reported.....   
Title: Re: [DONE] DotTune AFMA
Post by: Francis on March 25, 2013, 12:58:41 AM
Are you using the widest aperture?
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 25, 2013, 01:18:55 AM
Yes, the camera was set wide open. But even if it wasn't, the lens is always wide open when focusing, so it shouldn't make any difference.   
Title: Re: [DONE] DotTune AFMA
Post by: horshack on March 27, 2013, 04:51:34 AM
Quote from: msowsun on March 24, 2013, 11:56:35 PM
I have a 5D Mk II running v2.3.NEXT.2013Mar19 

While running Dot Tune AFMA with 200mm or longer lenses I would sometimes get a bug: Each and every MA box would light up green during the test on all 4 passes. (even with -100..+100 selected). This would result in a new AFMA of "0" and an Error message "Double-check the focus target".  This would happen a few times in a row. Changing Focus Targets, distance, and lighting, had no effect. I would then exit the program, reboot the camera, and try various other things until it went away.  This only happened a few times and I am not even sure how I was able to correct it.

Any thoughts on what was going on?

Your symptom sounds like the AF tune value being scaled by the ML logic wasn't being applied/utilized by the camera's AF logic for some reason. Please report back if you're able to reproduce this.
Title: Re: [DONE] DotTune AFMA
Post by: achangsta on March 29, 2013, 04:24:22 PM
Quote from: msowsun on March 24, 2013, 11:56:35 PM
I have a 5D Mk II running v2.3.NEXT.2013Mar19 

While running Dot Tune AFMA with 200mm or longer lenses I would sometimes get a bug: Each and every MA box would light up green during the test on all 4 passes. (even with -100..+100 selected). This would result in a new AFMA of "0" and an Error message "Double-check the focus target".  This would happen a few times in a row. Changing Focus Targets, distance, and lighting, had no effect. I would then exit the program, reboot the camera, and try various other things until it went away.  This only happened a few times and I am not even sure how I was able to correct it.

Any thoughts on what was going on?

I tested DOTtune yesterday and I had the same problem with all three of my zoom lenses. Every single box had a focus confirmation for all 4 passes, even with -100..+100. I kept getting an AFMA of 0. I tried multiple times with each lens, both on the wide and tele. I'm using the 5d3 with an unreleased ML version that has DOTtune.

Any ideas??

Here's a rundown of the procedure I used:
1. Put chart on a wall and positioned the camera at 50x the focal length (e.g., 24mm at 1200mm or 47.24in)
2. Manual focus and widest aperture on lens; single shot and single point AF on camera
3. Manual focus using LiveView with AFMA value "0"
4. Run DOTtune in ML
5. Every box gives focus confirmation, new AFMA of "0"
6. Repeated for -40 to +40 and -100 to +100, same results
7. Repeated for wide and tele on every lens, same results...
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 29, 2013, 04:29:08 PM
I had the problem with my 70-200mm 2.8 IS II with, and without, the 1.4x II. I only tried it at 200mm or 280mm. My other lenses never had a problem and I haven't been able to replicate the "Bug" since that first day. 

Which lenses did you have problems with?
Title: Re: [DONE] DotTune AFMA
Post by: achangsta on March 29, 2013, 04:33:55 PM
Quote from: msowsun on March 29, 2013, 04:30:11 PM
Sorry, double post. How do you delete a post?

The lenses I used are:
Canon 16-35mm f/2.8
Canon 24-70mm f/2.8
Canon 70-200mm f/2.8
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 29, 2013, 04:37:39 PM
I did reload ML and also went from the March 19 to March 24 Nightly Build, and haven't had it happen again.
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 30, 2013, 01:43:54 AM
I bought a new 17-40mm 4.0 today and it will not run AFMA.  Each time I run it all the squares light up and the AFMA result is of course "0".

My other lenses are all fine: 40mm 2.8, 50mm 1.8, 50mm 1.4, 24-105mm, including the 70-200mm 2.8 IS II which originally gave me problems.

Just the new 17-40mm is doing it, and it's done it about 10 times in a row. I tried it at different distances and with different targets. I also formatted the card and reloaded ML 2.3 with March 24 Nightly Build. Nothing helps.
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 30, 2013, 02:12:58 AM
Well I got the 17-40 to work now..... and here is what  I did....


I took my CF card and formatted it my computer. I then inserted into my 5D Mk II to get the Canon software on it.
Then I put it back into my computer and installed ML 2.3 and then back in the 5D Mk II and installed ML 2.3 to the camera.
Back in the computer and added 2.3.Next.2013.Mar29 and then ran that in the camera, and now it works!

FALSE ALARM! It ran once and now it is doing the same thing again.....  :(   I probably didn't have a proper focus.
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 30, 2013, 02:43:01 AM
Update....

If I run AFMA mode as "All Lenses" then it runs normally with the 17-40.
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 30, 2013, 09:20:23 AM
Quote from: a1ex on March 30, 2013, 09:08:17 AM
Does it help if you change the AFMA value from Canon menus first?

I just tried that and YES it works now!  :)

I guess it's still a Bug, but with an easy work around.
 
Title: Re: [DONE] DotTune AFMA
Post by: 1% on March 30, 2013, 11:08:31 AM
You have to "register" the lens from the canon menu first to use W/T.. a value in the property changes to 1. If you don't do that results may vary as you've seen.
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 30, 2013, 01:11:55 PM
Sorry, what is W/T ?  I always register the lens for Peripheral Illumination Correction but hadn't done it yet for the 17-40.
Title: Re: [DONE] DotTune AFMA
Post by: Francis on March 30, 2013, 05:10:43 PM
Wide and Telephoto. Some models allow adjusting the AFMA for both ends of the zoom range.
Title: Re: [DONE] DotTune AFMA
Post by: msowsun on March 30, 2013, 05:30:20 PM
The 7D and 5D Mk II don't have the Wide/Tele MicroAdjust option.  I think only the 6D, 5D Mk III and 1Dx have it.

(http://i2.photobucket.com/albums/y17/msowsun/photo%20stuff/Photo11/Clipboard01_zps8e25a5fe.jpg)
Title: Re: [DONE] DotTune AFMA
Post by: pulsar124 on April 21, 2013, 07:41:52 PM
I have another suggestion for dot-tune improvement. How about an optional 'cumulative' mode? Specifically, when testing zoom lenses or/and lenses at different distances from the target, one often gets different good dot-tune intervals for MA. E.g, my Sigma 17-50  has MA say -15...-2 at 17mm, and -5...+5 at 50mm. The current dot-tune implementation is not very useful for finding a single compromise value for MA which would be acceptable at any FL. All I get is either one FL or the other FL values; the important interval width information is discarded. But if ML had a cumulative mode, and let me run dot-tune a few times at different FL, and then computed a single compromise value taking into account interval widths, that would be very helpful. In my example, the common MA interval for both FL is -5...-2; the compromise value would be either -4 or -3. At the very least, you could make ML print out the intreval at the end of every calibration; the compromise value would be computed manually.
Title: Re: [DONE] DotTune AFMA
Post by: engardeknave on April 21, 2013, 08:46:22 PM
Maybe ML could dynamically set afma to predetermined values as the lens is focused.
Title: Re: [DONE] DotTune AFMA
Post by: Francis on April 22, 2013, 05:03:06 AM
Quote from: engardeknave on April 21, 2013, 08:46:22 PM
Maybe ML could dynamically set afma to predetermined values as the lens is focused.

Canon firmware only reports focal distances in Liveview, which does not use the 'tuned' autofocus system.
Title: Re: [DONE] DotTune AFMA
Post by: pulsar124 on April 26, 2013, 04:08:05 PM
So, no comments about my "cumulative mode" suggestion (see two posts above)? It wouldn't be too hard to implement (I think), and zoom lens owners would really appreciate it.
Title: Re: [DONE] DotTune AFMA
Post by: Francis on April 26, 2013, 04:20:42 PM
Sounds like you already know how to do it. Run the calibration at a few focal lengths and compute the average. The mean of the means should be close enough.
Title: Re: [DONE] DotTune AFMA
Post by: pulsar124 on April 26, 2013, 05:47:56 PM
No, I am not talking about means, I am talking about overlapping intervals, these are different things. In the case of say [-16...0] at one FL end and [-2...+2] at the other, the cumulative approach would yield MA=-1. The mean of means would yield MA=-4 - definitely bad number, as it is outside of the good MA values for the second FL.
Title: Re: [DONE] DotTune AFMA
Post by: horshack on April 30, 2013, 04:06:18 PM
Quote from: pulsar124 on April 21, 2013, 07:41:52 PM
I have another suggestion for dot-tune improvement. How about an optional 'cumulative' mode? Specifically, when testing zoom lenses or/and lenses at different distances from the target, one often gets different good dot-tune intervals for MA. E.g, my Sigma 17-50  has MA say -15...-2 at 17mm, and -5...+5 at 50mm. The current dot-tune implementation is not very useful for finding a single compromise value for MA which would be acceptable at any FL. All I get is either one FL or the other FL values; the important interval width information is discarded. But if ML had a cumulative mode, and let me run dot-tune a few times at different FL, and then computed a single compromise value taking into account interval widths, that would be very helpful. In my example, the common MA interval for both FL is -5...-2; the compromise value would be either -4 or -3. At the very least, you could make ML print out the intreval at the end of every calibration; the compromise value would be computed manually.

Generally speaking the width of the confirmed tune range is a function of FL, subject distance and DOF and may not yield any additional information useful for producing a composite tune value for multiple FLs. Experiments would need to be performed to prove otherwise. I'll try to experiment with it next week.
Title: Re: [DONE] DotTune AFMA
Post by: pulsar124 on May 03, 2013, 08:50:30 PM
Thanks - I am also experimenting with this right now.

Actually, one simple ML modification would accomplish most of what I'm asking for: if at the end of calibration ML would print on the screen not just the median value, but the good interval as well. Then one can do any kind of calculations with these numbers.

I know the good interval is a function of the distance - but so is the median MA value as well, for many lenses. As a result, MA calibration is normally done at the typical distances the lens is used, hence the good interval information should still be valid.

The essence of my original point is that not just the median, but the whole MA interval information is valuable, and should not be discarded. The whole interval corresponds to MA values deemed "as good as it gets" by the AF system of the camera (or at the very least as "sufficiently good"). I'd expect this interval being wider at shortest FL of zoom lens (because of deeper DoF), and more narrow at the longer end (more shallow DoF). Using my approach to find the optimal MA value would take this DoF behaviour into account, and allow you to find the MA value where AF deviation from the perfect focus is comparable (in DoF units) at any focal length.

Here is actually another possibility - even more accurate way to find the optimal MA for a zoom which has different MA and different interval widths at the opposite FL ends perhaps would be to assume the interval width (or rather half-width) as a std (standard deviation), and the compute the optimal MA as a weighted average, using the standard formula:

<MA> = [MA1/(del1**2) + MA2/(del2**2)] / [1/del1**2 + 1/del2**2].

All these different approaches can be tested, if only ML could print the good MA range at the end of calibration.
Title: Re: [DONE] DotTune AFMA
Post by: a1ex on September 19, 2013, 09:55:40 AM
Update: Dot-Tune is now a module.

https://bitbucket.org/hudson/magic-lantern/src/tip/modules/dot_tune
Title: Re: [DONE] DotTune AFMA
Post by: arrinkiiii on September 19, 2013, 12:31:41 PM
Oiééé,  thank you  :D
Title: Re: [DONE] DotTune AFMA
Post by: Doyle4 on September 22, 2013, 04:34:53 PM
Possible to add this to the nightlys? would love this on my mkii, used the old version as was happy with results, but this one looks like itll finally find the perfect focus.

Cheers.
Title: Re: [DONE] DotTune AFMA
Post by: Audionut on September 22, 2013, 06:44:54 PM
It is in the nightlies.  It is now a module that has to be loaded the same as all other modules.
Title: Re: [DONE] DotTune AFMA
Post by: a1ex on September 22, 2013, 07:22:38 PM
It was simply copy/pasted from core into a module (no changes in functionality).
Title: Re: [DONE] DotTune AFMA
Post by: Doyle4 on September 22, 2013, 09:24:25 PM
Ahh ok cheers, sorry i thought it had been tweaked slightly.

It did a fantastic job on my 100mm f2 and 24-70 2.8, -2 on the 24-70 considering it was sent to Canon to be tuned as it wouldnt keep focus and they said it was a user error, thanks to this its perfect.

Thanks again.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: O-Ren on September 26, 2013, 01:15:04 AM
Hey everyone

I'm using ML 2.3 (July 23), and have just updated to the latest Nightly build for 5D MKII 2.1.2. But I seem to have a problem with the DotTune module.

After installing ML, I overwrote
- the autoexec.bin file
- the complete ML folder 
on the CF card with the bin.file & the ML folder from the Nightly.
I enabled DotTune under the Modules menu, but pressing the Q button (picture style button) does not open any submenu(s). And the Set button switches the module to OFF. 
How can I get the DotTune to work?

Thanks
Xaris
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Marsu42 on October 02, 2013, 04:09:18 AM
This is broken on 6D, I hope someone can fix it since I'd really like to afma my lenses. Here's the bug ticket (on the TL repo): https://bitbucket.org/OtherOnePercent/tragic-lantern-6d/issue/16/dot_tune-afma-broken-on-6d
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: 1% on October 02, 2013, 07:48:46 AM
How?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Marsu42 on October 02, 2013, 10:56:09 AM
Quote from: 1% on October 02, 2013, 07:48:46 AM
How? You mean the screen turns off? You have to set that setting to disabled in the canon menu.

Ok, thanks, I've got it - two settings have to be different from what I had.

1. In "INFO button display options" -> "Display shooting functions" has to be enabled
2. Turn off LCD on halfshutter has to be disabled.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ShadowSAW on October 12, 2013, 08:08:28 PM
Hi, where can I find the dot_tune.mo for the Canon 60D DSLR?

Dot_tune runs on a Canon 60D?

I can not find this module in the nightlys updates for the Canon 60D
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Marsu42 on October 19, 2013, 06:59:36 PM
Quote from: ShadowSAW on October 12, 2013, 08:08:28 PM
Hi, where can I find the dot_tune.mo for the Canon 60D DSLR?

Canon removed af micro adjustment from 50d to 60d to protect their 7d (thanks, Canon!) and re-introduced on the 70d ... so dot_tune won't work with 60d.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: selmas23 on October 25, 2013, 09:36:21 PM
I just download ML to my 7D but cannot finde AFMA.
Is it possible to download somewhere?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: StefanKeller.AC on November 19, 2013, 10:48:03 AM
I loaded the module dot_tune.mo from the normal nightlies from 5D3
http://builds.magiclantern.fm/#/
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: r12 on December 24, 2013, 04:32:26 PM
when using the version of the nightly build for 5D3 there is only a micro adjustment option but the selection for tele/wide is missing.
Where can i find the right version?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: longastrino on December 25, 2013, 10:37:34 PM
where i can find the module to download?
thank's and Marry Xmas!!!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Balinor on January 10, 2014, 12:51:54 PM
I would like to use the dottune ML module on a 550D... I realise 550D doesn't have AFMA adjustment, I just want the AFMA value at a series of focal lengths and distances to pump into my Sigma 18-35mm lens using the Sigma USB lens dock. Anyone know if it's possible to get dottune to run on 550D?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ilguercio on January 10, 2014, 01:04:43 PM
Quote from: Balinor on January 10, 2014, 12:51:54 PM
I would like to use the dottune ML module on a 550D... I realise 550D doesn't have AFMA adjustment, I just want the AFMA value at a series of focal lengths and distances to pump into my Sigma 18-35mm lens using the Sigma USB lens dock. Anyone know if it's possible to get dottune to run on 550D?
It does nothing on cameras that don't have AF adjustments.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on January 10, 2014, 01:05:05 PM
Replace the get/set_afma calls to custom PTP wrappers that can talk to your Sigma dock (assumming it has a SDK) and it might work. If your dock doesn't have a SDK, maybe Sikuli can be useful to automate it.

Of course, you can use some other communication medium, such as LED blinks, beeps, or signals through the microphone port, but PTP seems the easiest way to me.

Difficulty: if you have the skills to get in top 1000 at Google Code Jam, you can probably implement this in a couple of days or weeks.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Marsu42 on January 19, 2014, 11:00:38 PM
Could someone please give some assessment on how reliable dot_tune is? It seems to work for me, well, for the one lens that needs afma at all (my 100L), but rumor on CR is that it's not reliable and you're better of with manual adjustment with a metering stick...

http://www.canonrumors.com/forum/index.php?topic=19032.msg358813#msg358813

I'm usually waving the flag for Magic Lantern over there, but in this case I've got too little experience with the module to say anything other than guesswork...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on January 19, 2014, 11:35:21 PM
The ML module implements the method faithfully, so you're asking whether the method is dependable.  For my own part, I've been very satisfied with DotTune.  When I first upgraded to the 50D, I painstakingly made lots of test shots and manual adjustments to figure out good AFMA values for my lenses.  Then I found out about DotTune, and I was pleased (but frankly also a little irritated!) with how easy it was, and produced AFMA values very close (<~1 tick difference) to what I had already determined.

Now, there are definitely times when DotTune misfires and gives a bad result, but I chalk that up to user error, such as not setting the perfect focus initially or accidentally bumping the camera when switching to manual focus.  Running through the procedure a few times can help confirm whether your value is trustworthy.

I suspect that those that see consistently incorrect AFMA values from DotTune are making some mistake in the setup/procedure and not realizing it.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on January 20, 2014, 04:40:03 AM
Quote from: ayshih on January 19, 2014, 11:35:21 PM
I suspect that those that see consistently incorrect AFMA values from DotTune are making some mistake in the setup/procedure and not realizing it.

Agreed.  When the setup is accurate, the results are accurate, and only subject to the errors inherent in lens/camera.

AFMA is subject to lens quality, lighting conditions, focus distance.

Quote from: ayshih on January 19, 2014, 11:35:21 PM
Running through the procedure a few times can help confirm whether your value is trustworthy.

Agreed.

Canon 5D3 manual states these points about AF and AFMA.

The AF's point of focus will vary depending on subject conditions, brightness, zoom position and other shooting conditions.  Therefore, even if you perform AFMA, focus may still not be achieved at the suitable position.

It is best to make the adjustment (AFMA) at the actual location where you will shoot.  This will make the adjustment more precise.


I've seen plenty of people unaware of focus issues with their shots, and those who mistake camera movement for focus issues.  Considering the accuracy needed in the testing procedure, and the variation of the AF accuracy subject to conditions, it's really no surprise some people may not get the results they were expecting.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: poromaa on February 08, 2014, 05:12:13 PM
Have I missed something here or does this feature not work in 5Dm2?
For any of my lenses (restored camera settings, new ml 8th of feb) - the dot-tune module iterates for eternity. It does not seem to change anything between the beeps and results always ends up at 0 (no change).

What have I missed? (RTFM - is there a manual somewhere?)

Regards
Joakim
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: naturalsound on February 20, 2014, 05:33:58 PM
Quote from: poromaa on February 08, 2014, 05:12:13 PM
Have I missed something here or does this feature not work in 5Dm2?
For any of my lenses (restored camera settings, new ml 8th of feb) - the dot-tune module iterates for eternity. It does not seem to change anything between the beeps and results always ends up at 0 (no change).

What have I missed? (RTFM - is there a manual somewhere?)

Regards
Joakim

To identify possible mistakes you should describe your setup completly.

What Lens, what target distance, what target?
Focussed in Liveview? Lens set to M afterwards? Doublechecked focus in LiveView?
Does it beep everytime for every AFMA-setting?
Title: Does auto-dot-tune compare ok with manual devices like LensAlign?
Post by: l_d_allan on February 20, 2014, 06:12:50 PM
Quote from: Marsu42 on January 19, 2014, 11:00:38 PM
Could someone please give some assessment on how reliable dot_tune is? It seems to work for me, well, for the one lens that needs afma at all (my 100L), but rumor on CR is that it's not reliable and you're better of with manual adjustment with a metering stick...

http://www.canonrumors.com/forum/index.php?topic=19032.msg358813#msg358813

I'm usually waving the flag for Magic Lantern over there, but in this case I've got too little experience with the module to say anything other than guesswork...

I've got similar concerns. In a recent DPR thread:
Autofocus correct or not? (http://www.dpreview.com/forums/post/53068582)
I also 'waved the flag' for ML's Auto-DotTune
and got a reply that was skeptical (http://www.dpreview.com/forums/post/53085009)

Years ago, I used an older LensAlign gadget borrowed from a photography club, which I found to be a hassle. The DPR post above mentioned:
Reikan FoCal Pro
I believe that Datacolor makes a version also.

Has anyone with a manual device such as those mentioned above compared the results to Auto-Dot-Tune?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Jockerl on March 20, 2014, 06:55:12 PM
I tested DotTune on my Mark III 1.2.3 (Bleeding Edge Build 17. March 2014) and used the mode "linear -20...+20". It additionaly performed the -40...+40 and -100...+100 tests. Is this a supposed behavior or did i make something wrong? Can anyone please look into it. I can give you more information and settings if you need it.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on March 20, 2014, 07:29:34 PM
Nope, that's a bug!  It looks to be an easy fix, and I just submitted a pull request (https://bitbucket.org/hudson/magic-lantern/pull-request/450/dottune-fix-for-fixed-scanning-ranges/diff) for review.  Incidentally, if you didn't know, you can do a half-shutter press to cancel a scan.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Jockerl on March 20, 2014, 07:35:56 PM
Thanks for your fast feedback and the fix :) When i cancel the scan it saves the wrong value, so your fix is the cleaner and better solution. I will test it, when its merged.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: poromaa on March 20, 2014, 07:44:20 PM
I have tried two lenses with mars 15 build.
Both goes on, putting random dots all over the line up to +- 100 (until I cancel).
My lenses are: Tamron 24-70 2.8 vc & Canon 50 1.4

Same behaviour on both lenses.
Camera: 5d mark ii
build:mars 14
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: yiliangliu on March 31, 2014, 06:58:12 PM
I tried the dottune on my 5D mark III and I did not see wide/tele option on the screen. I registered the lens, and it shows wide/tele on the regular Canon menu, but not in ML. How should I do to solve this problem? I used the latest version of ML firmware.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on April 01, 2014, 04:32:52 AM
Quote from: poromaa on March 20, 2014, 07:44:20 PM
Both goes on, putting random dots all over the line up to +- 100 (until I cancel).

Make sure you have critical focus (http://en.wikipedia.org/wiki/Critical_focus) on your target.


Quote from: yiliangliu on March 31, 2014, 06:58:12 PM
I tried the dottune on my 5D mark III and I did not see wide/tele option on the screen. I registered the lens, and it shows wide/tele on the regular Canon menu, but not in ML. How should I do to solve this problem? I used the latest version of ML firmware.

The module currently does not set these values.

Set the lens to wide, run DotTune, note down the adjustment.
Repeat at tele.
Manually input values through Canon menu.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: VisualPursuit on April 03, 2014, 01:31:40 PM
Not sure if I'm doing anything wrong.

DotTune gives me the spirits level tool blinking 3 times and then says
"Press INFO and try again".

EF 1.2/85mm L MkI on 5D Mk3 with 1.2.3. bleeding edge from March 31st.

Switched global draw off, C.Fn.4 off, manually focussed on target in
approx 4m distance in live view 10x zoom, then started the module.

Levels tool appears blinking three times, then it exits with the message above.

Any obvious user error?

Thanks, Michael
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on April 03, 2014, 01:38:46 PM
Enable the info screen from Canon menu (or reset Canon settings to defaults).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on April 03, 2014, 01:51:58 PM
C.Fn4 isn't an on/off option.  That is clear custom settings.
Is it actually level?

Here, the module enables the info screen.

Title: Re: DotTune AFMA (dot_tune.mo)
Post by: VisualPursuit on April 03, 2014, 01:54:17 PM
Enabling info screen didn't do it alone.
So I reset all camera settings and now it works perfect.

Thank you very much!

Lens ends up at -10 constantly.


Edit: Yes, I cleared custom functions for C.Fn4.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Blaster on April 07, 2014, 05:23:51 PM
I tried DotTune on my 6D (Tragic Lantern 4th of April 2014 version). I get focus confirmation for all the tests from -100 to +100 until i cancel.
I have tried:
resetting my 6D to default settings, I'm focusing wide open from LV, "Display shooting functions" is enabled, turn off lcd on halfshutter is disabled, All my lenses behave the same and I'm focusnig from 50*focal length.

Am I doing anything wrong? I really hope someone can help me :)
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Marsu42 on April 07, 2014, 06:30:33 PM
Quote from: Blaster on April 07, 2014, 05:23:51 PM
Am I doing anything wrong? I really hope someone can help me :)

I know this might not be very helpful right now, but I can confirm dot_tune does work on 6d, so the issue is on your side :-o
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Blaster on April 07, 2014, 06:33:00 PM
Quote from: Marsu42 on April 07, 2014, 06:30:33 PM
I know this might not be very helpful right now, but I can confirm dot_tune does work on 6d, so the issue is on your side :-o
that gives me hope :)

it turns out that it works correctly when I set AFMA mode to "all lenses", but not when it is set to "this lens" :S
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: tjaja on April 07, 2014, 09:51:30 PM
Did you choose one focus point first?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Blaster on April 08, 2014, 04:50:37 PM
Quote from: tjaja on April 07, 2014, 09:51:30 PM
Did you choose one focus point first?
Yes, but it works on "all lenses" so I can just note down the results and apply them manually for each lens, no problem.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: VisualPursuit on April 10, 2014, 01:32:08 AM
Okay, looks like there might be a problem.

Obviously DotTune works different for some lenses.
I ran through all my lenses, and with these reports
above in mind I remember that only two lenses completed
very fast and with a result other than zero.

I will check again tomorrow some of the lenses with
the "all lenses" setting.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: tacticole on April 10, 2014, 09:15:41 PM
Just did this test today with the current bleeding edge build (April 10th, 2PM)

Shot on the 5D Mark 3, with the 85mm 1.2 L Canon.

ISO 100, F1.8, Shutter at 1/200, using a printable focus chart about 1 meter away from the camera.

I ran the module after focusing manually with live view at 10x magnification, and it just runs to the +/-100 with a confirmation at each point. Is that because of the distance? Aperture? I use the flaat_10 picture style if that makes any difference in how the camera meters/focuses. New to the micro adjustment game, just figured I'd throw some information out to see if it's a user error or whatever. Thanks for the help!

Also, planning on doing this with the 35mm 1.4, 50mm 1.4, 16-35mm2.8, and 70-200mm 2.8 (all canon) and was curious if anybody has had positive result for any of those lenses.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: tacticole on April 10, 2014, 09:19:56 PM
Quote from: tacticole on April 10, 2014, 09:15:41 PM
Just did this test today with the current bleeding edge build (April 10th, 2PM)

Shot on the 5D Mark 3, with the 85mm 1.2 L Canon.

ISO 100, F1.8, Shutter at 1/200, using a printable focus chart about 1 meter away from the camera.

I ran the module after focusing manually with live view at 10x magnification, and it just runs to the +/-100 with a confirmation at each point. Is that because of the distance? Aperture? I use the flaat_10 picture style if that makes any difference in how the camera meters/focuses. New to the micro adjustment game, just figured I'd throw some information out to see if it's a user error or whatever. Thanks for the help!

Also, planning on doing this with the 35mm 1.4, 50mm 1.4, 16-35mm2.8, and 70-200mm 2.8 (all canon) and was curious if anybody has had positive result for any of those lenses.

Also for the record, the chart in question is here: http://www.testcams.com/DotTune/CrossHatch_Target.png

If I don't have luck with the 85mm, I'll try to other primes and see what I get.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on April 10, 2014, 10:40:23 PM
I'm not currently near my camera to do any testing, but when the module runs to +/-100 with a confirmation at each point, that likely means that the module is not actually managing to change the AFMA setting.  The most likely reason is that you are adjusting the AFMA by lens, but the particular lens is not yet registered with the camera.  All you should need to do is to use the Canon menu to first manually specify an AFMA setting, any setting, and then the lens will be registered.  After that, the module should work.

Alternatively, you can switch the AFMA mode to all lenses, and then the registration step isn't necessary.

Finally, I would encourage anyone who has difficulties with the module to make clear whether or not he/she can successfully use the DotTune approach in the manual fashion (i.e., not using the module).  That will help distinguish between issues with the module and issues with the setup.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: tacticole on April 10, 2014, 11:29:47 PM
Quote from: ayshih on April 10, 2014, 10:40:23 PM
I'm not currently near my camera to do any testing, but when the module runs to +/-100 with a confirmation at each point, that likely means that the module is not actually managing to change the AFMA setting.  The most likely reason is that you are adjusting the AFMA by lens, but the particular lens is not yet registered with the camera.  All you should need to do is to use the Canon menu to first manually specify an AFMA setting, any setting, and then the lens will be registered.  After that, the module should work.

Alternatively, you can switch the AFMA mode to all lenses, and then the registration step isn't necessary.

Finally, I would encourage anyone who has difficulties with the module to make clear whether or not he/she can successfully use the DotTune approach in the manual fashion (i.e., not using the module).  That will help distinguish between issues with the module and issues with the setup.

Yes! Thank you, this solved my issue. To clarify for anybody else, I went into the canon menu, accessed the AFMA settings and made sure to click 'Register' when dealing with a specific lens. I changed the value to -1, set it, then went back in and changed it to zero again, just to make sure it saved a value of some sort specifically for the lens. Ran the module and it no longer gave me the +/-100 issue. Thanks for helping ayshih.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: l_d_allan on April 18, 2014, 05:18:28 PM
Quote from: tacticole on April 10, 2014, 09:15:41 PMISO 100, F1.8, Shutter at 1/200, using a printable focus chart about 1 meter away from the camera.

That seems to be too close. Canon recommends 50x focal length, which would be about 12' away with the 85mm ... ~ 4 meters, if I did the math correctly.

I suppose if your primary use for the 85mm is head+shoulders portraits, that might justify doing the AF-MA at that specific distance.

It appears from your later post that you got the 85mm AF-MA to work. Great! For those who are struggling to get Auto-Dot-Tune to behave, it would probably be a good thing to start at 50x distance. Once it is working, then and only then use something other than 50x.

The 85mm f1.2L would certainly be a lens that would benefit from AF-MA, with its very shallow DOF.

It would be interesting to see what the setting for it would be at 1', 3', 8', 12', 50', and infinity.

FWIW: My speculation is that the newer Sigma lenses with their "Dock" allow AF-MA at different distances. I am unclear how that would integrate with a Canon body however.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on April 18, 2014, 05:25:44 PM
Quote from: l_d_allan on April 18, 2014, 05:18:28 PM
FWIW: My speculation is that the newer Sigma lenses with their "Dock" allow AF-MA at different distances. I am unclear how that would integrate with a Canon body however.

With (some Sigma) fixed focal length, you can program the AFMA at 4 different focal distances.  I used the camera, setup at each focal distance, and ran dot_tune, then made note of each setting and used the dock to program the lens.  Then the camera set back to 0 AFMA value.

With (some Sigma) zoom lenses, you can also program different focal lengths, as well as focal distance at each focal length.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: l_d_allan on April 18, 2014, 05:26:19 PM
Quote from: ayshih on April 10, 2014, 10:40:23 PMAlternatively, you can switch the AFMA mode to all lenses, and then the registration step isn't necessary.

I've wondered if there would be a scenario where this option makes sense. My impression is that you'd be making the assumption that the setting for one lens is better, or even optimal for other lenses.

I suppose if you only have time to AF-MA one lens, it's not completely unrealistic to "cross your fingers" and proceed with the assumption that your other lenses could use the same adjustment. Seems flawed, as I'd think you'd be better off the leave the other lenses at 0.

Suppose you did AF-MA on your most used 85mm f1.8L, and found it was very far away from the default zero, such as +18 or even +45. That would seem to suggest that the manufacturing tolerances of the body and/or lens was borderline. (and also the value of having a body with AF-MA).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: l_d_allan on April 18, 2014, 05:28:40 PM
Quote from: Audionut on April 18, 2014, 05:25:44 PM
With (some Sigma) fixed focal length, you can program the AFMA at 4 different focal distances.  I used the camera, setup at each focal distance, and ran dot_tune, then made note of each setting and used the dock to program the lens.  Then the camera set back to 0 AFMA value.

With (some Sigma) zoom lenses, you can also program different focal lengths, as well as focal distance at each focal length.

Interesting. Thanks for the reply. I'm curious if you noticed much difference between subject distances, and also with different focal lengths.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: l_d_allan on April 18, 2014, 05:40:04 PM
Quote from: tacticole on April 10, 2014, 09:19:56 PM
Also for the record, the chart in question is here: http://www.testcams.com/DotTune/CrossHatch_Target.png

Thanks. Looks like a nice target, except I'd think you would want some or many diagonals in both directions (slanted up and slanted down).

I made up a target from large and small fonts, then put in cross-hatches and diagonals. For a while, Auto-Dot-Tune was always reporting "Bad Target", but I think that was a minor s/w bug with a "dangling if", IIRC. I'd make up what I thought was a better target, it still kept being reject. That's been fixed.

Also, I believe A1ex wrote that the quality of the target didn't have to be all that great / precise / complicated, like you'd use for ImaTest. The main thing is to have plenty of contrast. Or not?


Title: Re: DotTune AFMA (dot_tune.mo)
Post by: l_d_allan on April 18, 2014, 05:42:39 PM
Quote from: tacticole on April 10, 2014, 11:29:47 PM
To clarify for anybody else, I went into the canon menu, accessed the AFMA settings and made sure to click 'Register' when dealing with a specific lens. I changed the value to -1, set it, then went back in and changed it to zero again, just to make sure it saved a value of some sort specifically for the lens. Ran the module and it no longer gave me the +/-100 issue. Thanks for helping ayshih.

Thanks to both of the posters with this suggestion, and clarification.

I've had problems with my Sigma 150-500mm. It adjusts fine with my older 5d2, but not the 6d. I'll see -100 to +100 all confirmed. Perhaps I didn't register the lens on the 6d? I'll retry.

Quote from: Blaster on April 08, 2014, 04:50:37 PM
Yes, but it works on "all lenses" so I can just note down the results and apply them manually for each lens, no problem.

Interesting work-around. I'll give it a try if the "pre-registration" step doesn't resolve the issue I'm experiencing. I will have to remind myself to be extra careful and not get in a hurry, especially with this approach.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Canon eos m on April 18, 2014, 06:07:19 PM
Will try the workaround this weekend.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: anakaine on April 20, 2014, 05:16:00 AM
I'm feeling a little bit special - How can one access to +40 / -40 adjustments?

I am running a 7D on the latest nightly, and have one lens how AFMA  value is reporting a +16 to +20, which is where the scale ends.

Is the fact that the +40/-40 options are missing a product of the 7D not supporting the larger values, or am I just missing something? There's only Auto, or +-20 in the DotTune settings.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on April 20, 2014, 02:29:03 PM
Quote from: anakaine on April 20, 2014, 05:16:00 AM
Is the fact that the +40/-40 options are missing a product of the 7D not supporting the larger values, or am I just missing something? There's only Auto, or +-20 in the DotTune settings.

There are two issues at work here:
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: anakaine on April 21, 2014, 11:32:47 AM
Is this something I can help test? More to the point, is trying to ask the camera to go past +-20 something that is likely to cause issues, hardware wise or other?

I must apologies if the answer for testing is yes, as I'll be out of general internet range for 2 weeks beginning in a few hours time (I work very very remotely). Sometimes I get satellite, which is flaky at best. Happy to help in a fortnight providing there's no risk of irreparable damage.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: rassilon on May 03, 2014, 12:14:43 PM
Quote from: ayshih on April 20, 2014, 02:29:03 PM
There are two issues at work here:

  • The 7D is not one of the three cameras (50D, 5D2, and 5D3) that currently have CONFIG_AFMA_EXTENDED defined in their respective internals.h, so the AFMA values stop at +/-20 instead of +/-100.  Presumably someone needs to confirm that the 7D can accept extended AFMA values without problem.
  • The DotTune module is slightly broken currently because it still has checks for CONFIG_AFMA_EXTENDED and CONFIG_AFMA_WIDE_TELE despite being a module now.  This needs to be fixed by replacing with functions and variables from afma.c.  In the meantime, no camera will show the options for extended fixed ranges (+/-40 or +/-100), but cameras with CONFIG_AFMA_EXTENDED defined will be able to access extended values in Auto range detection.

I have a Canon 5D Mark III and use the current nightly builds for 1.2.3 and mine only goes up to +/- 20.  It will tell me that I should try +/- 40 but it doesn't say how to get to that.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on May 04, 2014, 05:39:30 AM
Leave it in "auto range detection", and it will use whatever it thinks is necessary.

Quote from: ayshih on April 20, 2014, 02:29:03 PM
In the meantime, no camera will show the options for extended fixed ranges (+/-40 or +/-100), but cameras with CONFIG_AFMA_EXTENDED defined will be able to access extended values in Auto range detection.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: vadim on May 24, 2014, 01:39:53 PM
Installed on Canon Mark 5d III latest version of 23rd May 2014. However cannot see menu dottune AFMA. Any idea why?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on May 24, 2014, 01:47:53 PM
Enable the module from the module menu first.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: martinMK on June 16, 2014, 11:20:29 PM
Can there be more than -100/+100 adjustment in the DotTune?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on June 17, 2014, 05:40:55 AM
Why exactly?   If your lens needs that much correction, you should probably send it in for calibration.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: martinMK on June 21, 2014, 08:59:54 AM
It is for M42 lenses
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: martinMK on June 22, 2014, 02:49:23 PM
I have successfully calibrated the majority of the lenses I have with DotTune.. great extension on ML..

I was asking for the max values of the compensation scale inorder if I need sometimes bigger than +100/-100..

I am a programmer in C/C++/C# and from my understanding of the code for this module the multiplier is the key..
Although the code at first glance seems simple I do not know the architecture of the ML and its modules.. and in my spare time I try to study the source code..
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on June 23, 2014, 01:42:00 AM
If it looks simple, it probably is.
I don't recall the reason for the current limits, but since this is a module, and as long as you are not setting a Canon property, worse case should be a soft crash.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Tomas.D on July 19, 2014, 04:49:18 PM
I just downloaded nightly builds . I can´t find the dot_tune.mo  on my 600D. 
how to act ?
Regards Tomas
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on July 19, 2014, 05:22:20 PM
600d isn't capable of AFMA tuning. that's available for 50D, 7D, 6D and 5Dmk2/3...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Tomas.D on July 20, 2014, 06:16:50 AM
Hi. thank you for your answer
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: pulsar124 on July 26, 2014, 12:51:42 AM
I've been doing MFA of my lenses for a few years now, and tried most of the approaches (e.g., I wasted my money on the commercial product Reican FoCal - terrible customer support, never worked on my Windows XP laptop), and found the dot-tune method (either manual, or with ML) to be the best. There is only one feature I wish the ML's implementation of dot-tune had: at the end of the calibration, I'd want to see not just the median MFA value, but also the good MFA interval (the lower and higher values). The reason: MFA values are different at different distances to the target, and at different focal lengths of zoom lenses. And the only way to find the optimal (good for any distance and/or focal length) MFA value is to determine the good MFA min...max intervals at all distance/FL combinations, and then overlap these intervals, and find the more narrow interval (if it exists) which would be present in all of the individual intervals.

A point in case. A couple of days ago I re-calibrated all my 4 lenses. My fast zoom lens (Sigma 17-50mm f2.8) was the most tricky as usual. I measured the good MFA intervals by observing the output of the ML on my camera screen. This is not very reliable, but this is the best I could do. I did three distances (1, 3, 8m) and three FLs (17, 30, 50mm). I obtained the following good MFA intervals:

Sigma 17-50 OS: -3 [-3.5,-2]

    1m: [-3.5,-2]
        50mm: -10, [-18,-2]
        28mm: +1, [-7,+9]
        17mm: +4, [-3.5,+11.5]
    3m: [-8,+0.5]
        50mm: -7, [-14.5,+0.5]
        28mm: +0, [-9.5,+9.5]
        17mm: +0, [-8,+8]
    8m: [-7.5,+5.5]
        50mm: -2, [-10,+6]
        28mm: -3, [-11.5,+5.5]
        17mm: +0, [-7.5,+7.5]

As you can see, the biggest tension was at the shortest distance - 1m. If all I had was the "optimal" (median) MFA values reported by ML, then I'd be in a difficult situation trying to pick the best number from -10, +1 and +4. But everything is much more straightforward when you compute the overlapping part of the three intervals, which was pretty narrow: -3.5...-2. All other distances and FLs were consistent with this interval. So I went ahead and chose one value from that interval, -3, and it indeed works very well at all distances and FLs.

If instead I chose to simply average all the 9 median MFA values, I'd get -2. This would still probably be okay, but I feel the interval approach gives much more reliable result.

Can printing the good MFA interval on the camera screen be implemented in ML? I think it'd be a very useful addition, and suspect quite easy to implement.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on July 26, 2014, 05:35:04 AM
It'd be easy to implement your request, but I think you're over-complicating things.

First, I'll point out that you'd get virtually the same results if you simply assumed intervals of +/-8 around the optimal AFMA values.  For your data, the optimal interval would then come out to be [-4, -2], which is essentially the same as [-3.5, -2].

Second, the ranges don't even really matter.  Note that your method of intersecting intervals is entirely anchored by the most extreme optimal AFMA ranges; the intermediate ranges don't actually constrain the overall intersection at all.  Thus, you could simply take the average of the two most extreme optimal AFMA values.  For your data, that's -10 (50mm at 1m) and +4 (17mm at 1m), and the average is -3, which is exactly the same value you already settled on.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: pulsar124 on July 27, 2014, 02:54:24 PM
I agree that your approximate method does work reasonably well in my case (though intervals are not always +-8 - I have +-10, and for some finicky lenses that might make it or break it in terms if pinpointing the only reasonable MFA value which would satisfy all the constraints), but why settle for approximate if one could easily obtain the real thing - the actual good MFA intervals? My thinking is that the good MFA intervals are the primary data, while the "optimal" MFA is a derivative. I'd feel more confident analyzing the primary data when dealing with particularly finicky zoom lenses.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on July 31, 2014, 09:57:05 PM
Bug confirmed on 6D:
"This lens" option doesn't work correct for some lenses. e.g. if I use this option on my 70-200 then only at 70mm it will do AFMA. With that option it will do at 200mm too but won't beep so won't find any focus beep.

If I set to "all lenses" then it will work fine at 70mm and also on 200mm and in between. Value for 70mm differs heavily compared to the value I git from "this lens" where as stated above 200mm wouldn't beep at all...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on July 31, 2014, 11:18:19 PM
Hmm, curious.  I'll have to try this out on my own camera, but this may be a 6D-specific bug.  On your Bitbucket issue (https://bitbucket.org/hudson/magic-lantern/issue/2071/afma-dottune-this-lens-option-fails-on-6d), you say that at 70mm you get -16 with "all lenses" and -6 with "this lens".  When you look at the actual focus performance, is one of those values actually correct?  In each of those cases, is the interval about 16 steps wide?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on July 31, 2014, 11:29:37 PM
Ah, the 6D is one of the cameras that can set two different AFMA values at the ends of a zoom lens, so it's almost certainly related to that.  On a related note, if you haven't ever set two AFMA values in the Canon menu for this lens, the registry may not be properly initialized.  Hopefully the "all lenses" AFMA values are correct, and then you can simply switch back to "this lens" and manually set the values using the Canon menu.

Note that this module itself is currently broken towards being able to handle a zoom lens and two AFMA values.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on August 01, 2014, 12:00:59 AM
Seems to be spot on for -16 at 70mm and -1 at 200mm using "all lenses".
I have no clue why I get -6 at 70mm at this lens and werent able to get a beep between 71-200mm using "this lens" setting
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: pulsar124 on August 01, 2014, 09:58:49 PM
You know that you can always do the dot-tune manually, by clicking the half-shutter button and changing MFA value manually? You can do that to detect which ML method (if any) produces the correct result on your 6D.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: JoHoeller on August 04, 2014, 06:16:30 AM
I seem to have a problem with using dottune on my 5D Mark III. I have been using Magic Lantern for a while on different cameras but just decided to try out this feature. I hope somebody can help me solve the issue.

I am using the newest nightly for 1.2.3 firmware (magiclantern-Nightly.2014Jul30.5D3123.zip). I have set up the camera on a tripod and focused on my target within liveview. When I start dottune from within ML the camera turns of liveview, toggles the info screen a couple times and then quits with the error message "press INFO and try again". I have tried the same procedure various times and also varied my distance from the target but keep getting the same result. I also tried to search for an explanation to the error message but came up empty.

Does anybody know how to fix this error or what I am doing wrong?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on August 04, 2014, 07:13:45 AM
Thanks for the detailed description of the problem!  It may not make a difference, but can you try switching out of LV yourself before starting the DotTune scan?

It sounds like this may be a 1.2.3-specific problem, and the relevant check that is failing is:


...
if (!display_is_on() || !display_idle())
...

That is, ML keeps toggling the info screen because it either thinks the display isn't actually turning on (display_is_on() is returning false) or that the display, while on, isn't idle (display_idle() is false).  If there isn't a bug with one of those functions, then another possibility is that the module is not waiting long enough before checking to see if the display is idle.  Here's a build of dot_tune.mo where I have increased the wait time and added some information to the error message you are seeing.  Can you give it a try?

Can any other 5D3 users chime in on whether DotTune works for them, on either 1.1.3 or 1.2.3?


Edit: resolved
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on August 04, 2014, 08:18:38 AM
Some users have disabled the Canon info screen (the one with shutter, aperture, ISO and so on), so ML can't reach it by pressing INFO. Make sure it's not that.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: JoHoeller on August 04, 2014, 08:44:05 AM
Thanks a lot for the quick reply @ both ayshih & a1ex

a1ex's suggestion actually solved the problem. I usually just use my hardware buttons and top LCD display and have therefore disabled the "functional settings" for the INFO button, leaving it to show "camera settings" and "levels" only. After changing this setting the module runs without any problems.

As I am sure some other people will also run into this issue, would it be possible for the script to enable the "functional settings" on INFO before it runs and change back to the original settings later? Another option might be to change the error message since it really does not give any hint to solving the issue.

Either way, thanks a lot to both of you!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: JoHoeller on August 04, 2014, 12:43:51 PM
Unfortunately I met another problem running the script.

As you might know, the 5D mk3, as well as some other new Canon cameras (1DX, 6D, 70D), offer the option for 2 AFMA adjustments (wide & tele). When I change the AFMA setting in Magic Lantern it adjusts both of these values within the Canon menu. I wanted to run the script and later change 1 value back manually.

For my prime lens (100mm 2.8 L, only 1 value in Canon menu) everything worked like a charm and the script identified a perfect match. For my Zooms (tested 24-105 4.0 L and 16-35 2.8 L before I gave up) the script did not work. For these 2 lenses the script ended up getting confirmation for all values from -100 to +100, leading to a calculated value of 0. When I manually adjusted the values for either wide or tele in the Canon menu (depending on which focal length I was testing) I ended up with the correct information and different values.

I checked all my lenses manually by now but still wanted to report the issue to you for future updates. I hope you are able to fix it and integrate the new wide / tele AFMA into ML.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on August 08, 2014, 09:00:14 AM
A few fixes, please review: https://bitbucket.org/hudson/magic-lantern/pull-request/577/dot-tune-afma-fixes

I can't test it myself on zoom lenses, sorry.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: theloafingone on August 16, 2014, 12:23:20 PM
Sorry if this has already been asked (I tried going through the entire thread/searching google), but how perfectly parallel/aligned do the camera/lens have to be to the target?
I'm asking this because I have a hard time telling if it is perfectly aligned to the target or not so I kind of eyeball it but am not sure just how much of an affect a degree or two off will have on the end result.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on August 16, 2014, 12:50:58 PM
I for myself didn't notice much changes by some degrees. Also i recommend you to redo your tests at different lengths and/or locations.
For example when I did my tests at home I got almost the same results when doing them outside against a wall or whatever.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: theloafingone on August 16, 2014, 11:41:08 PM
Quote from: nikfreak on August 16, 2014, 12:50:58 PM
I for myself didn't notice much changes by some degrees. Also i recommend you to redo your tests at different lengths and/or locations.
For example when I did my tests at home I got almost the same results when doing them outside against a wall or whatever.

I was under the impression that the lighting conditions where you test can have an effect on the results. Don't they?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Stedda on August 17, 2014, 02:07:38 PM
Quote from: theloafingone on August 16, 2014, 11:41:08 PM
I was under the impression that the lighting conditions where you test can have an effect on the results. Don't they?

They do for me... inside/outside totally different numbers using FoCal which is usually very accurate.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on August 23, 2014, 12:46:33 AM
Canon manuals state that focus can vary depending on brightness (among other conditions), and recommends that microadjustment be performed at the location of shooting.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Brupikk on September 26, 2014, 01:43:23 PM
Hello,

My T4i/650D has Back/Front-focus issue, does ML have AF microadjustment for this camera?

Thanks

Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on September 26, 2014, 02:17:02 PM
No! This module only works for cams which have af fine tuning by factory (besides 60D).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Pedr on October 31, 2014, 12:39:49 PM
Please will someone confirm whether this can be used with zoom lenses? If I was to do this manually, I would adjust the value for the wide and tele ends of the lens, but this process only runs once at one focal length and sets both values.

On running this with my EF 70-200 this gives me:

When run at 70   : Both values are set to 0
When run at 200 : Both values are set to 6

How should I calibrate for both ends of this lens? Should I run it at each end, then input the values manually?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on October 31, 2014, 01:54:58 PM
You found out both values (wide / tele). So why not enter them manually in canon original cfn menu?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Pedr on October 31, 2014, 02:40:56 PM
That's exactly what I suggested in the last sentence:

QuoteShould I run it at each end, then input the values manually?

I was just interested if there was anything built in. If there isn't, maybe it would make sense to add an option to run it as diagnostic-only - so it doesn't actually save the value - as overwriting both values is not correct in any circumstance so far as I am aware unless the adjustment happens to be the same.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on November 02, 2014, 08:31:33 PM
There is supposed to be the capacity to change just one end at the time (merged in August (https://bitbucket.org/hudson/magic-lantern/pull-request/577/dot-tune-afma-fixes/diff)).  Questions:
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Pedr on November 06, 2014, 12:22:20 PM
Build: Nightly.2014Aug07.5D3123
Camera: 5D Mk3

There is an AFMA mode option, but the only values are Disabled | All Lenses | This Lens
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ayshih on November 06, 2014, 04:35:28 PM
Ah, the 5D3 1.2.3 nightly build isn't quite up to date.  This module was fixed on August 19.  Can you try swapping in the dot_tune.mo file from the 1.1.3 nightly build?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: codyb on December 15, 2014, 03:34:17 AM
Are some lenses too generous with microfocus adjustments for this method to work?  I just successfully ran my 85 1.8 (on a 6D) through the run and it came out with +4.  But I tried the 35 2.0 (non-IS version) and the focus confirm pings successfully across the entire -100 to +100 range.  I was using a target of some 12pt font on standard 11x8.5 both 3 feet away and 6 feet away.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ashram on July 18, 2015, 08:47:33 AM
I'm a little late to the party.
Trying out Dottune I set it to autodetect the range and set the AFMA mode to Tele end.
Everything runs as expected utilising the 100 range and returns a new AFMA value of -31.
Whilst ML seems to store this value in the dottune menu, there is no change in the Canon menu and the Canon menu has only +-20. (adjustment in ML menu is reset to 0 on reboot).
Testing autofocus with this ML config set there doesn't appear to be any difference to having it set to 0 (using a chart on 45degrees).
I presume it needs to be set in the canon menu for this to work, but ML dottune fails to write this value (is it supposed to?) and if I am to enter it manually how do I translate -31 into the Canon menu when it only goes +-20?
Do some cameras use larger ranges or do they calculate them differently?  For example if I am limited to +-20 do I need to divide -31 by 5 to give me an adjustment of -6 (rounded) for this camera?  (I think this is what the code is doing)

5D Mk III Firmware: 1.1.3
ML Nightly 02 Jul 2015
Canon EF 24-105 F4 L IS USM

Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ultrazauberer on July 27, 2015, 10:49:04 AM
Yesterday I tried DotTune AFMA with my 6D, the latest nightly build (of course from yesterday) and the 50mm f1.8 STM lens.

I set the AFMA to prime lens in the ML-Menu. I focussed a black tripod in front of a white wall. The tripod was 2,5m far away from my camera. I focused the tripod via liveview and set the AF off. Then I started the dottune script, leaving everything at default except above mentioned setting.

The focus was recognized for every AFMA value (-100 ... +100). That should not happen or am I wrong? Because of this behavior I could not finish the script. I tried to rearrange my setup and it fails again. Can anyone say something to this combination of camera and lens?

PS: I tested it with daylight and no artificial light.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on July 27, 2015, 12:55:07 PM
Anyone else able to confirm this on 6D 1.1.6?
Can you downgrade your firmware to 1.1.3 and verify your result with http://builds.magiclantern.fm/jenkins/job/6D.116/296/artifact/platform/6D.113/magiclantern-Nightly.2015Jun09.6D113.zip ?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ultrazauberer on July 29, 2015, 11:16:53 AM
I can do it but before I want to test something else.

I'm focusing with the back-button and disabled the AF on the shutter button. Maybe this is confusing the script?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ultrazauberer on July 30, 2015, 06:04:11 PM
Today I tried the Canon 85mm f1.8 with DotTune. Again no luck. Look at the video and see the strange behavior.

https://youtu.be/-PLZ2sUixYk

At the weekend I try to downgrade the 6D to 1.1.3.

Am I'm doing some wrong?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on July 30, 2015, 06:51:26 PM
@Ultrazauberer: looks buggy to me. Try 1.1.3 and let us know about your results. Another 6D owner reading this might chime in and try to reproduce...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ultrazauberer on August 03, 2015, 04:25:51 PM
Sorry for the waiting but I think I will test it next sunday. The problem is that I have next saturday a important photo shot and can't risk my camera. So I will wait after the shot. Stay tuned. ;)
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: vertigopix on August 04, 2015, 09:12:37 AM
Hello,

No problem here with 6D 1.1.6 AFMA is working with every lens I have (Canon, Sigma)
Maybe you can check with manual ISO... And do a correct exposure before you launch the process.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: SpuTTer on August 05, 2015, 12:28:51 AM
I can try and test on my 1.1.6 6D. Will report back.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: SpuTTer on August 05, 2015, 09:11:49 AM
It worked for me on the 6D 1.1.6 firmware. Although I had some inconsistent results, doesn't seem to be anything wrong with the build.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ultrazauberer on August 05, 2015, 09:14:54 AM
Okay. How do you have your AF configured? I'm using backbutton focussing for the AF, so the AF function isn't on the shutter button. Maybe that's the problem?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: vertigopix on August 05, 2015, 10:35:57 AM
Quote from: Ultrazauberer on August 05, 2015, 09:14:54 AM
Okay. How do you have your AF configured? I'm using backbutton focussing for the AF, so the AF function isn't on the shutter button. Maybe that's the problem?
You must disable AF and do it yourself manually through the viewfinder or with the liveview.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Ultrazauberer on August 06, 2015, 12:02:44 PM
Quote from: vertigopix on August 05, 2015, 10:35:57 AM
You must disable AF and do it yourself manually through the viewfinder or with the liveview.

Yeah, I know. I described it earlier. When you looking at the video you can see it, how I done the test.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Shake on August 07, 2015, 05:21:37 PM
I have a related problem here.
I have a 5DIII. On my setup every setting seems to result in a perfect focus...

But I have also configured the focus on another button...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Shake on August 07, 2015, 05:36:52 PM
Hey. Found it out: It seems necessary to enable AI SHOT. Servo does *not* work....

Hmm. Too soon: Does not work anymore. Did not change anything, just switched the lense... Now every check is positiv.... :-(
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: dfort on September 06, 2015, 07:23:58 PM
I was doing some code cleanup on the EOSM and can't figure out how to keep it from building the dot_tune module. It keeps failing to build the module and of course the EOSM doesn't have AFMA, or does it? Maybe it is just hidden from the the Canon menu? Comparing firmware dumps of the EOSM with the 7D it looks very similar so I made an afma.c that looks like this:

// using 7D AFMA constants as a test -- comparing the firmware looks promising
#define PROP_AFMA 0x80010006

// have no idea how to figure this out for the EOSM
static int8_t afma_buf[0x17];
#define AFMA_MODE       afma_buf[0x05]
#define AFMA_PER_LENS   afma_buf[0x11]
#define AFMA_ALL_LENSES afma_buf[0x13]


and with a few other tweaks got the module to build and show up on the menu:

(https://farm6.staticflickr.com/5650/21193863715_5b09e6ebf5_z.jpg)

Of course it isn't running:

ML ASSERT:
PROP_LEN(80010006) correct:0 called:17
at ../../src/property.c:342 (prop_request_change), task GuiMainTask
lv:1 mode:3


So it looks like the next step is to try and figure out the afma_buf values, uh any hints besides trial and error? Before I go too far and possibly destroy the camera I was wondering if I'd have better luck teaching pigs to fly than to get dot_tune working on the EOSM?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on September 06, 2015, 08:08:00 PM
Better give up on this. EOS-M is liveview only. and the autofocus is done via contrast detection. So no need to play with this on EOS-M. AFMA is only suitable for dslrs when using the viewfinder in photo mode
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: dfort on September 06, 2015, 08:13:17 PM
Thanks nikfreak. Saved me a lot of time and possibly a fried camera.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: DeafEyeJedi on September 07, 2015, 01:15:38 AM
Ah makes sense actually!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: akumiszcza on January 22, 2016, 09:01:47 AM
Hi. As for the 6D/1.1.6 problems.
I'm using the current nightly (magiclantern-Nightly.2016Jan14.6D116.zip) and I can say that DotTune AFMA sometimes works, sometimes not :)
For my first trial (with 50 f/1.4) I got the whole range. After different try (different focusing card among other things) I got no AF... After several trials I think I get best results with:
- manual ISO (100)
- M mode
- lowest f value of course
- exposure slightly to the right (for better contrast, +1 or so)
- IS turned off
- AF-ON key changed to default value
- new focusing card taken from original youtube video (http://www.testcams.com/DotTune/CrossHatch_Target.png)
- distance from the card = 50 x focal length (more less)

I don't know which of these are important, though. Even after doing everything, for some lenses/focal length I had to do it manually, as in original youtube video (https://www.youtube.com/watch?v=7zE50jCUPhM). One tip: you don't have to enter Canon menu, setting it in DotTune AFMA module works the same (just remember to pick if it's prime/wide/tele). So it's fast anyway.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: lozw on March 12, 2016, 05:54:51 PM
duplicate post
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: vertigo235 on March 17, 2016, 03:40:02 PM
Found an issue using 1.2.3 and the DotTune module on 5D3.

I found it working fine on prime lenses, but on my zoom lenses DotTune would scan all the ranges and would never find a boundry (like described above).  I tried the prime/tele both, and the applicable wide / tele settings and got the same result.

I assumed that ML was having trouble adjusting the values, so I switched to "All by same amount" mode, and this worked fine.   So it appears when a zoom lens is attached ML can only adjust the AFMA on the "All by same amount" mode.

Anyhow, so the easy workaround is to do the DotTune with this mode then manually change the values for the Tele and Wide once the values are calculated.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: trojannemo on June 03, 2016, 04:07:40 AM
I wonder if I'm doing this wrong or if DotTune isn't working or if by some miracle all my lenses are perfectly aligned.

So far I've tried:

Canon 16-35mm f/4L IS - both wide and tele ends
Canon 40mm f/2.8 pancake
Canon 50mm f/1.4
Canon 100mm f/2.8 Macro

And they all beeped along the whole way and at the end said AFMA was 0. Maybe all my Canon lenses are perfectly aligned. Sure.

So I tried with my Sigma 150-600 C at both 150mm and 600mm. Again, beeped all the way and suggested AFMA was 0 for both ends.

This is on a 6D using the latest firmware and Magic Lantern as of the end of April.

Am I so lucky and all my lenses are perfectly aligned, or something is off here?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: pulsar124 on July 16, 2016, 07:38:29 PM
Anyone had issues with the new Canon's prime, 50mm f1.8 STM?  This is the first lens where dot-tune on ML doesn't seem to work - it shows perfect focus for the entire range of MFA. Perhaps it has something to do with the fact that this lens uses "focus by wire" (focusing is not mechanical, it's electric; e.g. it doesn't work when the camera is powered down or the lens is disconnected from the body)? For other lenses dot-tune works just fine.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on July 16, 2016, 08:11:31 PM
Does it help if you first adjust the AFMA value from Canon menu?

Also, does adjusting the AFMA value manually from ML menu reflect in the Canon menu setting, and the other way?

Also, if you adjust the AFMA value from ML menu, does it actually make a difference on the focus point? (yes, try it, I can imagine ways where the value set by ML could appear in Canon menu without having any effect on focus calibration)
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: pulsar124 on July 18, 2016, 06:09:04 PM
Sorry, it was my fault - I think I tried to run dot-tune in Av mode (which seems to work with other lenses, but probably not with the new 50mm  lens). I tried the test again, this time in Manual mode, and it worked as expected - giving me the MFA = -6, -6 -5 at distances 8, 3, and 1m. (BTW it looks like MFA changes a lot near MFD ~0.3m: it became +13 in my test).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on July 18, 2016, 09:40:48 PM
Interesting, I didn't expect the shooting mode to make any difference. Can you reproduce the issue? (that is, does it fail every time in Av mode, while working just fine in M? or is the misbehavior a bit random?)
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Manofmayo on August 03, 2016, 07:36:15 AM
Am I missing something?   I Have the latest nightly build on my 6D, and I can't get Dot Tune to display on the menu.  I have tried different settings (M, A, S, B) and lenses (Sigma 20 Art, Canon 35 IS, Canon 50 1.4) with no luck.   I admit I haven't gone through every post, so if that is what I need to do, just tell me please.

Thank you!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Audionut on August 04, 2016, 06:25:36 PM
http://www.magiclantern.fm/forum/index.php?topic=12713.0
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: DeafEyeJedi on August 04, 2016, 08:47:01 PM
Quote from: a1ex on July 18, 2016, 09:40:48 PM
Interesting, I didn't expect the shooting mode to make any difference. Can you reproduce the issue? (that is, does it fail every time in Av mode, while working just fine in M? or is the misbehavior a bit random?)

@pulsar124 - were you able to reproduce this yet?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Manofmayo on August 11, 2016, 08:45:32 PM
I have a question about repeatability.   I ran DotTune for my Sigma 20 Art 5 times, refocusing each time, and I got values of -6,+10,-4,-5 and -15.   Throwing out the high and the low, that makes for a AF tune of -5.   I did the same thing with the Canon 35 IS and the Canon 50 1.4 and had a much large range of values (mostly between -10 and +10).   Does this make sense?

I used MF, One Shot, wide open with exposure +2/3, in a bright room with a target 2m away.

I would expect repeatability to be within 5 units each time (or a max range of 10).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: russellsnr on October 14, 2016, 07:10:31 PM
Hi, Just tried Dot Tune with my 6D after watching available videos.
When I start the operation the screen on my 6D goes black the SD card shows activity via the red light flickering and then I get with some lenses a result others not so but my question is "should I be seeing the the active screen working" IE shows the passes 1 to 4 or is the blank screen now the way it goes? Thank You.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on October 14, 2016, 09:09:15 PM
If the display is not on, dot_tune attempts to press INFO/DISP a few times. If that doesn't turn on the display, the calibration process refuses to run.

If you get different behavior, that's a bug.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: Marsu42 on October 16, 2016, 12:30:12 AM
Quote from: Manofmayo on August 11, 2016, 08:45:32 PM
I did the same thing with the Canon 35 IS and the Canon 50 1.4 and had a much large range of values (mostly between -10 and +10).   Does this make sense?

Nope - with my dot_tune experiments, everything worked as expected and the differences were in the +-2-range. The main source of error course is the distance to the target, but if that's fixed it should work.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: russellsnr on October 16, 2016, 08:54:39 AM
Hi, Tried again, the D/T works on the 6D but the screen is blanked out until finished then comes up to show the adjustment also the adjustment shows in the camera so as not a whiz on this I assume the calibration has been done correctly. Thanks. Russ
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on October 16, 2016, 10:05:01 AM
Does the screen turn off when you press the shutter halfway? If yes, that should explain the behavior.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: groundlessfears on December 18, 2016, 08:55:41 AM
hi, i have tuned my Tamron 24-70 f2.8 vc lens and i got -5 and -15 but, its giving better focus now, but can anyone suggest the distance to the subject so i re tune the lens more accurately.? both wide end and tele end distance..
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: nikfreak on December 18, 2016, 11:34:44 AM
You could try to calculate an average value for both the wide and tele end if you have some luck. Probably dottune will spit out different values depending on the distance to your object. The ambient light will affect your results, too.

Now if you have luck and done all your tests you might want to calculate an average value. Makes ofc no sense if for e.g. on wide end you get let's say -5 for 1meter distance and have -15 for 3meter distance. But if it's like -5 and -7 and -6 then you could average it to -6 and be fine with it. YOu rbest bet is ofc to send it in to Tamron with your body for calibration....
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: grzegorz1987 on December 28, 2016, 11:00:47 PM
Please will someone confirm whether this can be used with zoom lenses? If I was to do this manually, I would adjust the value for the wide and tele ends of the lens, but this process only runs once at one focal length and sets both values.


Eos 5D Mark II - My Lens  EF 50, EF 17-40, EF 24-105, EF 100-400, Extender 2x,
On running this with my EF 10-400 this gives me:

When run at 100   : Both values are set to 0
When run at 400 : Both values are set to 12

How should I calibrate for both ends of this lens? Should I run it at each end, then input the values manually?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: stiefel40k on March 11, 2017, 06:13:22 PM
Hi,

I'm very new here, so I don't know if I post this in the right place. So I was trying to build ML for 600D because I intend to write an encrypion module with chacha, however as I was trying to build the project, to see if everything is fine I encountered numerous errors with the compiler and co. After fixing everything only one error resides and it is that I can't build the dot_tune module. The compiler error looks like this:
Building module dot_tune...
Updated HGVERSION
[ README   ]   module_strings.h
[ CC       ]   dot_tune.o
[ HGDIFF   ]   hgdiff.tmp
[ MODULE   ]   dot_tune.mo
[ STRIP    ]   dot_tune.mo
[ OBJCOPY  ]   dot_tune.mo
[ RM       ]   hgdiff.tmp
[ EXPORTS  ]   dot_tune.sym
[ DEPENDS  ]   dot_tune.dep
Will NOT load on:
    600D (get_config_afma_wide_tele, get_afma_mode, set_afma_mode, and 3 others)
Not checked (compile ML for these cameras first):
    1100D, 500D, 50D, 550D, 5D2, 5D3.113, 5D3.123, 60D, 650D, 6D, 700D, 7D, EOSM
make[4]: *** [../../modules/Makefile.modules:79: dot_tune.dep] Error 1

********************************************************
WARNING: module dot_tune failed to build, deleting
********************************************************


I tried to build ML e.g for 500D as the output suggests, but no help. I tried to understand what is happening in the Makefile.modules, but I had no luck :(
Regarding this I would have two questions:

Thanks for the help in advance!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on March 12, 2017, 08:48:18 AM
That's how the build process checks the compatibility between some module and the camera model. In particular, this module requires the camera to be able to change AFMA.

Those models that don't have this functionality won't have symbols such as get/set_afma_mode, so they won't be able to load this module. The message also tells what functions you need to implement for your module to load on a particular camera model.

You may cross-check your compilation log with the one from nightly builds (see Build log).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: stiefel40k on March 12, 2017, 05:47:55 PM
Quote from: a1ex on March 12, 2017, 08:48:18 AM
That's how the build process checks the compatibility between some module and the camera model. In particular, this module requires the camera to be able to change AFMA.

Those models that don't have this functionality won't have symbols such as get/set_afma_mode, so they won't be able to load this module. The message also tells what functions you need to implement for your module to load on a particular camera model.

You may cross-check your compilation log with the one from nightly builds (see Build log).

Thank you very much alex for you quick answer!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: quimic on July 18, 2017, 05:39:04 PM
Hi,
I am new to this, and I don't know what I am doing wrong, but it looks like during the automated fine tune process the lens manages to focus every time (I can see the focus confirmation), from -100 to 100. I tried with two different lenses, with the same result. I used a f/1.8 lens to have a shallow depth of field, but it made no difference.
I am using a 7D. I wonder if anyone is experiencing the same thing...

Title: Re: DotTune AFMA (dot_tune.mo)
Post by: pulsar124 on September 10, 2017, 10:45:09 PM
I just spent some time trying to make it work on my new camera (Canon 6D) with my new lens (Tamron 24-70 f2.8 VC). Two points:

- I couldn't make it work (the camera would continue beeping on all the points tried - no bad points at all), until I followed the advice I found online: to switch the camera (using Canon's menu) to "All lenses by same amount" option, in the AF microadjustment menu option.
- Despite the almost perfect setup, the dot-tune method produced very inconsistent, and mostly wrong results, in particular for the tele-end (70mm) of the lens. My setup: high quality target printed on a large piece of paper (12x18"); direct sunlight on the target; 5m distance from the target; initial focusing done using a remote control (smartphone connected to the camera via USB cable or WiFi), to prevent camera shaking when focusing; sturdy tripod for the camera; multiple tries (refocusing every time). I was getting MFA mostly around -2 ... -5, and around -8 for the wide end (24 mm). When testing these values directly, by taking shots of the target I discovered that the -3...-4 value for the tele-end were consistently producing images which were obviously less sharp than contrast detection shots. When I switched to constant MFA=-7, both tele and wide end shots became as sharp as contrast detection shots.

I've been using dot-tune for years, but unfortunately it looks like dot-tune results should be taken with a grain of salt. I will be re-testing my other lenses, as I don't have confidence in dot-tune results anymore.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: shinoda on December 20, 2017, 04:13:33 PM
I don't understand how to use this on a 17-50mm : which setting do i have to use and Canon AF and Dottune ?

As Pulsar said, when I set "This lense : wide" or "tele" (and the Canon settings to "This lense") it just continues beeping. I have to use "All lense" on Canon and ML menus for dottune to work. But will it register different AF settings if needed for both wide and tele end ?

Why is there this setting (wide / tele) if it isn't working at all for zoom lenses...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ArcziPL on April 11, 2018, 12:34:30 PM
Hi Shinoda, let dot tune run at wide end with "all lenses" setting. After it's done, note down the result. Change lens position to tele, run dot tune again with "all lenses" setting. After it's done, note down the result. Then change mode to " per lens adjustment" and set manually the noted values, separately for wide and tele. It's still not adapted to do it automatically for all cameras, but anyway useful.

BTW, which camera model do you have? I need this workaround for 70D.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: shinoda on June 26, 2018, 11:05:42 AM
This is indeed for the 70D, thank you for your help, I'm gonna try this right now!
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: c_joerg on December 07, 2018, 08:31:23 PM
I tried to run dot_tune on my 6D with EF 50mm f1.8 STM. I used different targets in around 2m distance.   
I used 4 passes and AFMA mode 'This lens, prime/both'. I also used all Scan types.

I always get a really constant score graph and result is always 0. I never seen a score graph like in Reply #14. How can it be?
How important is the light source?


(https://i.ibb.co/vQBpKJQ/IMG-2254.jpg) (https://ibb.co/vQBpKJQ)

(https://i.ibb.co/F6jGGg0/Image1.jpg) (https://ibb.co/F6jGGg0)





Title: Re: DotTune AFMA (dot_tune.mo)
Post by: c_joerg on December 08, 2018, 09:07:50 AM
I have done some more tests with an EF 24mm f2.8 IS USM. Also, I have done this test with different targets and lighting situation. However, I could not test in daylight yet. No matter what range I set, it always comes out a very flat constant score graph. What does that mean?

With the 24mm I sometimes get the value -2 at -100 +100, which cannot be confirmed in a 40 or 20 range.

Is it actually possible for you to freeze the results at the end? Or make a snapshot on the end?
Especially if you scan in automatic mode it takes a long time. It would be nice if the results were longer in the end.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on December 08, 2018, 09:31:57 AM
Is ML able to change the AFMA value on these lenses? In other words:
- if you change the value manually from ML menu, is the change visible in Canon menu?
- if you change it from Canon menu, is the change visible in ML menu?

If any of these is not working, can you try to change the AFMA value from both Canon menu and ML menu, while logging the MPU communication with this build (https://builds.magiclantern.fm/jenkins/view/Experiments/job/startup-log-mpu/)? This log should allow me to reproduce the issue in the emulator. A log covering some part of the AFMA scan process would also help. It doesn't have to be complete; MPU logging is stopped automatically after 20 seconds.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: c_joerg on December 08, 2018, 12:35:44 PM
I just checked the 50mm
Quote from: a1ex on December 08, 2018, 09:31:57 AM
- if you change the value manually from ML menu, is the change visible in Canon menu?
Yes
Quote from: a1ex on December 08, 2018, 09:31:57 AM
- if you change it from Canon menu, is the change visible in ML menu?
Yes

Should I still use the logging? 20s is not much to start the dot_tune...



I only started with the tests because the focus on the viewfinder varies a lot from shot to shot depending on the target and the light ...
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: a1ex on December 08, 2018, 12:49:59 PM
Any luck performing the DotTune procedure manually, as explained by the author (horshack) ?

For example, if you hold the camera still, focused on the chart, and you change the AFMA value to some extreme values (say +/- 100 or whatever the menu allows), do you still get focus confirmation? After some threshold, you should no longer get the confirmation.

Maybe the focus chart is "too sharp" and you still get AF "confirmation" even if the image is somewhat out of focus? Just a guess; back then, I've only tested on regular subjects (i.e. something with fine print or other sharp details, but not on a dedicated focus chart). I did not test on 6D, but other users reported success.

Otherwise, I'm out of ideas. You could try looking at previous posts for suggestions, but I guess you already did that.

I'd still like the logs, if possible. It won't cover the entire dot_tune process, but as long as it catches a few AFMA value changes, it's fine. Manual adjustments from both Canon and ML menus should be covered, too (just scroll through a few values, nothing fancy).
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ArcziPL on December 08, 2018, 04:59:00 PM
I assume it might be a bug in DotTune, which I experienced on 70D.

Workaround: change the DotTune to use ~"same settings for all lenses" instead of separate setting for each lens. Then run it, it should deliver the right result. Note it down, change mode to per lens correction and dial in the values manually. I was shortly looking at the source some time ago in order to fix it but didn't have enough time to really manage it... It just seems the DotTune always changes the value ~"same settings for all lenses", ignoring the mode selection during the scan, so the value it's setting during the scan has actually no effect, when a different mode is chosen.
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: c_joerg on December 09, 2018, 11:26:50 AM
Quote from: a1ex on December 08, 2018, 12:49:59 PMI'd still like the logs, if possible.

Can I upload the log directly?
https://drive.google.com/open?id=1rqfUPcqdmjB7iuPuFNBYeOXLKz8rAvPF

Quote from: a1ex on December 08, 2018, 12:49:59 PM
For example, if you hold the camera still, focused on the chart, and you change the AFMA value to some extreme values (say +/- 100 or whatever the menu allows), do you still get focus confirmation? After some threshold, you should no longer get the confirmation.

That's works very well. Max range in the Canon Menu is 20.

Quote from: a1ex on December 08, 2018, 12:49:59 PM
Maybe the focus chart is "too sharp" and you still get AF "confirmation" even if the image is somewhat out of focus?

As can be seen from Reply # 267, I use different charts. The different charts and lighting have a big impact on the variance of the viewfinder focus. Here are my previous experiences:
A Siemensstar in artificial light is the worst case. Here the focus has the most varianz. It gets a bit better in sunlight. Horizontal and vertical lines have less variance. Horizontal lines work best, presumably because only one component of the cross sensor is used.

Here you can see how the setup is at the Canon service for the adjustment:
https://www.dslr-forum.de/showpost.php?p=15313563&postcount=40

Quote from: ArcziPL on December 08, 2018, 04:59:00 PMI assume it might be a bug in DotTune, which I experienced on 70D.

It looks quite like this...

Quote from: ArcziPL on December 08, 2018, 04:59:00 PM
Workaround: change the DotTune to use ~"same settings for all lenses" instead of separate setting for each lens.

This works very well even in the 20 range :) . Thanks for the hint.
Is it correct that every time I start the camera, the scan range is set to Auto?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: c_joerg on December 10, 2018, 06:38:53 PM
To see the impact of the of different charts, I attached two score charts. The upper diagram comes from the Siemensstar, the lower one comes from the target proposed by the DotTune method.
(https://i.ibb.co/1Q4M9sg/DOT-TUNE-50mm.jpg) (https://ibb.co/1Q4M9sg)
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: ArcziPL on December 10, 2018, 11:26:35 PM
Quote from: c_joerg on December 09, 2018, 11:26:50 AM
Is it correct that every time I start the camera, the scan range is set to Auto?
No idea but there is no reason you shouldn't stick to it. And I mean it as a person who usually hates all the "auto" stuff. ;) The implementation of the auto algorithm is really smart. It combines ~binary search to find the coarse range with fine sweeping afterwards.

Try to rather not use the +/-100 mode as it sweeps with the step of 5, meaning that the final accuracy is only +/-5. The +/-20 method can also deliver a worse result than the auto if the values of +/-20 are still not beyond the borders of focus confirmation.

BTW, from my experience: I don't find the Dot Tune method the ultimate solution for focus problems. I'm used to still apply additional corrections based on photographing of real subjects and not focus charts. It seems to make a difference... Also the calibration distance matters as lenses can have an error depending on the it... But it's a good starting point and hopefully you don't have to play with the correction further, like I had to. Maybe I just have really bad lenses?
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: c_joerg on December 11, 2018, 06:11:52 PM
Quote from: ArcziPL on December 10, 2018, 11:26:35 PM
No idea but there is no reason you shouldn't stick to it. And I mean it as a person who usually hates all the "auto" stuff. ;) The implementation of the auto algorithm is really smart. It combines ~binary search to find the coarse range with fine sweeping afterwards.

The auto mode takes only a very long time

Quote from: ArcziPL on December 10, 2018, 11:26:35 PM
Try to rather not use the +/-100 mode as it sweeps with the step of 5, meaning that the final accuracy is only +/-5. The +/-20 method can also deliver a worse result than the auto if the values of +/-20 are still not beyond the borders of focus confirmation.

I know that ;)

Quote from: ArcziPL on December 10, 2018, 11:26:35 PMBTW, from my experience: I don't find the Dot Tune method the ultimate solution for focus problems. I'm used to still apply additional corrections based on photographing of real subjects and not focus charts. It seems to make a difference.

The problem is not the method rather that the focus through the viewfinder varies greatly depending on the target.

The attached plot shows 10 shots of the Liveview focused and 10 shots of the viewfinder (Same chart). It is easy to see that the sharpness of the live view almost does not vary at all. The shots on the viewfinder vary very strong. The plot is the worst case with a Siemensstar. Shown is the relative degree of focus of an image determined as described here:
https://de.mathworks.com/matlabcentral/fileexchange/27314-focus-measure


My idea was: Comparison (with a script on PC) of an image that was focused on the live view with 21 shots that were focused in the range + -10 on the viewfinder. But here it was the same, after each test, the focus was different. You have to live with the fact that the focus on the viewfinder varies.
(https://i.ibb.co/s61q4p4/6-D-Liveview-Viewfinder.jpg) (https://ibb.co/s61q4p4)
Title: Re: DotTune AFMA (dot_tune.mo)
Post by: rtr989 on January 02, 2019, 10:33:37 AM
I try to measure my 24-105L on two cameras 5D2 and 50D, i got the same results:
24mm = -5
60mm = +3
105mm = -1

measurements were carried out at the rate of 50 x focal lenght to target.
the difference is not linear and about 9 points at different focal lengths, but i can store only one digit in my cameras, i know in newest camera user can store data for wide and tele ends, but it also does not solve the problem completely.
Is it possible to make lens profile and track focal lenght in real time for change AF microadjustment data?