Detect Focused Area of Image and Compose

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Posts: 1
Joined: 2016-06-23T06:52:37-07:00
Authentication code: 1151

Detect Focused Area of Image and Compose

Post by bramak »

I have a bunch of photographs which are basically a sequence of images of a single scene with the difference that in each sequence a different area of the subject has been focused on. What I want to do is compose these sequence of images such that the final image has only the focused areas of each image.

In my head, I can picture this needing the following steps:
  • - Detect the focus area in each image in the sequence.
    - Use the above results in a compositing/blending operation.
I'd appreciate if you could give me some leads on how to go about this with ImageMagick.

Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Detect Focused Area of Image and Compose

Post by Bonzo »

I would guess Imagemagick is not the best program for this. I would suggest you search for focus stacking software.

There are some paid for programs around as well as Combine ZP which is free.

Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Detect Focused Area of Image and Compose

Post by snibgo »

It is possible with IM, but not quick. A stack of 24 photos tooks two hours on my previous laptop.

Aside from sharpness, a method also needs to account for (a) change of scale due to focusing (caused by moving the lens or the entire camera) and (b) slight shifts in image positions (caused by wobble in the mechanics). This takes most of the time.

Optimisations would doubtless improve the speed. I decided the results weren't interesting enough to continue development.
snibgo's IM pages:

Posts: 1
Joined: 2016-07-16T11:24:45-07:00
Authentication code: 1151

Re: Detect Focused Area of Image and Compose

Post by Pax2You »

I'd like to do focus stacking as well. Does anyone know of a safe spot to download Combine ZP?