Magic Lantern Firmware Wiki

Focus Assist

328pages on
this wiki
Add New Page
Talk0 Share

Many users are requesting focus assist tools [1] [2] [3] for their Magic Lantern-enabled DSLRs.

/* scroll down for video */

Magic Lantern FAQEdit

According to Six Ways at forums, the zoom and focus peaking focus assist features "work with or without a chipped adapter," as " Neither of these depend on the lens or the camera AF-confirm." This is significant, as it allows the use of manual lenses such as Nikon or Olympus, to be used with a focus assist feature typically found only on expensive monitors.

Zoom during RecordingEdit

AJ posted some very impressive demos which enable zoom during recording:

See 2.0.4 AJ and this discussion.

Focus peakingEdit

Input data: LiveView buffer: VRAM/550D, 2.0.4_5D2_VRAM_overlay

There are VRAM segments with 720p YUV data when idle, which increase to 1080p when recording. AJ found a bunch of them: ASM Zedbra.

5D2 has edge detection implemented, but it seems it's too slow for real use. Users say it's not very good [4]. Anyone has a link with screenshots or discussion about this?

A tentative of estimating the "amount" of focus is here: [5].

There is an implementation of edge detection in C which claims to be very fast [6] (didn't test it).

Focus with Image MorphologyEdit

My empirical observations show that morphological operation (dilate/erode/open/close) [7] [8] [9] [10] may help with focus assist. However, they are computationally intensive.

In simple words:

  • Dilate: expands white (light) areas of image
  • Erode: expands the black (dark) areas

Basic idea: focused areas have details which are lost by open/close operation. Out of focus areas don't have those details.

Thresholding edge imageEdit

  • fixed: you risk to display either a big, red mess in a sharp scene, or nothing at all if you have a softer lens.
  • adaptive: what about percentile? e.g. display the sharpest 1% pixels

thumb|300px|left|Testing percentile threshold (1%) with edge detection

Experiment: is morphological method more accurate than edge detection? if yes, is it worth optimizing it?Edit

(probably not)

  • Method 1: simple edge detection, based on horizontal and vertical differences between adjacent pixels:
# octave3.2, y is YUV luma
dyh = y(1:end-1,1:end-1) - y(1:end-1,2:end);
dyv = y(1:end-1,1:end-1) - y(2:end,1:end-1);
e = abs(dyv)+abs(dyh);
  • Method 2: diff between original frame and morpho-closed one.
  • Method 3: diff between original frame and morpho-opened one.
  • Method 4: add images from 2 and 3.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.