Saturday, August 17, 2024

Simple image stacking with GIMP

What is it?

When taking pictures, not everything is in focus. The depth of field - the area in focus - is smaller as you magnify the image. With macro photography, the magnification can be so great, that most of the subject may be out of focus.

Focus stacking takes multiple images focused at different points, and merges them into an image with a deeper depth of field - more of the subject can be in focus.


Here's a Japanese Beetle I focus-stacked using 3 images.

Dragonfly, stacked from 3 photos.


There are several tools to accomplish this - Helicon Focus, Zerene Stacker, Enblend, Combine ZP. These generally have some requirements - number of images, how close they are in focus, how closely they are aligned etc.

I'm using GIMP because I'm generally taking pictures of subjects without a tripod. I shoot handheld, so I can't control focus precisely. I can however from a couple bursts select a few with good focus over parts of the subject I like - and even if the subject moves a little, I can somewhat align the portion of the subject so that it can be used. Shooting like this can have images that are rather difficult for software to align. Aligning a few images like this doesn't take too long in GIMP though.

Get GIMP here.


How to do it?

First up - let's add a keyboard shortcut to GIMP to enable/disable layer masks. This will let us toggle a mask on and off to see what we should "color in".

Bring up the keyboard shortcuts menu (Edit-> Keyboard shortcuts)



Enter "disable" and search for "disable layer mask". This can be done by a few mouse clicks, but let's save some time.



Click on the shortcut (disabled) and you'll get a "New accelerator" prompt. This is waiting for a keyboard shortcut. You can use what you like - use something already in use and GIMP will warn you. I used Alt+D. 



Work on the pictures you'd like to use. I recommend not using a vignette filter as the brightness of the part you may want may not match. From the set I've chosen, you can see I was bobbing about trying to keep centered (it's a small fly!). My gear was an Olympus E-M1 iii, an Olympus 40-150mm F4-5.6 and a NiSi 58mm close-up filter.


Open the pictures up in GIMP. From here, determine what you'd like to use as the main image. I picked the one where most of what I wanted was in focus.

Take note of the images you open and what is in focus. I used three images where different parts are in focus - circled in red.




Copy one of the images you'd like to add to your "main" image and paste it as a layer. You can rename the layer too. Here you can see the area in focus is the right wing, near the fly's body.


For this layer, it's way off the alignment of the main image. To align it, change the layer mode to difference. 



Now the images would look weird - but you can see both the original and the new pasted layer. You can select the move tool (upper left) and drag the layer to align that part of the image you want with that part of the original - in my case, the right-wing was in focus - so that's what I aligned.

Note that as the images align, the difference-mode selected will darken - as there is less of a difference there. This helps you know if it's aligned. Also note, that not all of the fly appears to be aligned - that's fine. I just wanted the wing here. The fly was moving about, so getting a part mostly aligned is good enough.


Now add a layer mask - right click on the new layer and select add layer mask.

Select all black, fully transparent - to the pasted layer. This makes the layer completely transparent. This way we can "color in" the focused areas.


By toggling the layer mask (Alt+D) it will disable/enable the transparency. Do this to see what looks sharper when disabled - that's where you paint!


Setup your tool - select the foreground color (click on it) as white. 


Select the airbrush tool. This will seamlessly paint-in the area in focus without a harsh edge.


Take note of the size of the brush used. You can increase/decrease the size, rate and flow to speed up the painting - just be aware that some areas will need a little more precision.



Toggle the image mask using Alt+D to determine where looks sharper. Then select the mask in the layer pane and airbrush the area into focus.


Repeat this for each image you want to use. For moving subjects where a layer may have multiple parts in focus, but can't all be aligned, just use that layer multiple times, adjusting it for the part you want in focus. You can even use transform tools to rotate or skew parts to get them to align better.

The final result may get you more than you thought possible. I'm quite happy with this result. A couple bursts on a random fly. Five images - one main, with others lending sharper left and right wings, right eye, right antenna, left leg, rear hairs... etc.


Gear used:

The kit tele-zoom is astonishingly capable for such a cheap lens. With the NiSi close-up filter, it performs admirably. Used, it's often under $100 (keep in mind "four-thirds" is not "micro-four-thirds"!!!). The 58mm NiSi close-up filter is ~$80. A Raynox DCR250 will also work well. There are plenty of cheap close-up single-lens filters, but these use multiple lenses to prevent chromatic aberrations (achromatic close-up filter). That's $180.

The Olympus 30mm macro will cost less - usually less than the $180 needed for this combo - and it's sharper. The problem is the working distance. The maximum magnification on the Olympus 30mm macro, will have you 14mm away from the subject. The 40-150+macro filter will keep you several comfortable inches away.

This pairs well with a flash and diffuser when you want more light. The entire setup is relatively light. The E-M1.3 can be almost any other camera for similar image quality. I do like the grip though, as with the flash and diffuser, it does make the setup easier to manage. 


Other uses:

The use of layers like this to merge different parts of a photo can be used for other purposes - e.g. take multiple images of a scene with people and merge the areas without, reducing or eliminating people from the scene entirely.

________________________________________



I hope this may be useful to some. Macro is a fun way to experience photography, as it eliminates a lot of elements you may want/need for a photo - weather, location, light (if using flash), etc. Happy shooting! 🙂






Thursday, March 7, 2024

Full Frame, APS-C, Micro Four Thirds, what does this all mean?

What is full frame and why is it a reference?

source: https://petapixel.com/color-photography/

In a nutshell - Full-frame was a popular film format, 36x24mm in size. That format carried through to today's professional digital cameras. Lens focal-length equivalence is often used because the same lens will give different compositions on different cameras. Discussion among photographers involving lenses would bring up full-frame equivalent focal lengths. This way, photographers using any format could follow along.

Kodak introduced "135" film in 1934 as a standard film cartridge. This film records images at 36mm x 24mm. By the 1960s, it was the popular standard. This popularity continued till the advent of digital photography. It left us with the common idea of the "professional" format - Full Frame - using these dimensions. The next major competitor is APS-C - a similar rectangle at 2/3rds the side length. Micro Four Thirds is another format even smaller than APS-C. By the time the digital age was upon us, 35mm film/cameras/lenses had dominated the industry for decades. Cost and technical difficulty propelled smaller digital sensors into lower-tier consumer markets, with the expensive "Full Frame" sensors directed to professional or higher-end consumers.

A given lens will create an image when focusing on a medium. The image can be recorded on photographic film or a digital sensor. If you're curious, you can hold a lens near a window, and hold blank paper behind it. Move the paper close to the lens until the image is in focus. You should see an inverted circular image of what's outside the window.

Holding my Nikon 50mm and trying to focus it on this pad while taking the picture proved quite clumsy.

A full-frame camera would render a picture as if drawing a 36mm x 24mm rectangle in that image. An APS-C sensor is about 24x16, and would be that smaller rectangle. A M43 sensor would be a 17x13 rectangle in that image.

FOV Equivalence:

Right away the idea of smaller sensors being crops of the full-frame image should come to mind. It's a tighter field of view - so how can you get a similar picture? The main idea of equivalence should be about framing your shot. 

Let's assume that you liked 50mm lenses on full-frame cameras. If you picked up a micro four-thirds camera, what lens would give you a similar feel? Well because of the smaller sensor, you will need a wider lens. 25mm is quite close. If you were looking for a lens on APS-C cameras, you'd need 35mm.

This is where the idea of crop-factor comes into play. It is the ratio of the sensor's diagonal, comparing the full-frame sensor to the cropped sensor of APS*/M43 and other sensors.

APS-C has a crop-factor of 1.5 (in general - Canon does 1.6). Micro four-thirds has a crop factor of 2. These numbers can be used to quickly figure out equivalent focal lengths on their respective systems.

Most smartphone cameras have a crop-factor of 5 or 6.


Depth Of Field Equivalence:

When your camera is focused on a point, some objects in front of and behind that point are also in focus. This area of sharpness is the "depth of field". 

If I composed a shot on the full-frame A7II, then with the same lens I'd need to recompose on the smaller sensor Panasonic G9. I'd have to step back because the lens has a narrower field of view on that smaller sensor. If you step back, you increase the depth of field.

If instead I switch to a wide lens to compose the image in the same place? Wider lens, increased depth of field. The only way to frame it and get the blur right would be to use a wider lens and faster aperture.

If I wanted to blur the background of an image, and I shot 50mm F2.8 on the full-frame camera, I'd need to shoot 25mm F1.4 on the Micro four-thirds for the same shot. If I shoot 50mm F1.4 on the full frame, I wouldn't be able to copy the depth of field at that composition, because I'd require a 25mm F0.7 lens for micro four-thirds.

This will matter more to photographers using fast zooms, for which there are few equivalent options in crop sensor formats. A 2.8 zoom can still give great subject isolation and background blur on a full-frame camera. The equivalent would be an F2.0 zoom on APS-C or an F1.4 zoom on micro four-thirds. Lenses with those f-stops don't really exist (OK.. Sigma's F1.8 zoom and Panasonic's F1.7!) but some primes can deliver enough blur - or just shoot differently. Nobody says you must take every type of shot, with every camera.


Depth of field equivalence is usually not as important as some make it appear:

When taking pictures it's helpful to know the field of view. Are you shooting wide, normal, or telephoto. Are you trying to compress the image and pick your backgrounds or capture as much of the sky as possible?

I switch between full-frame and micro four-thirds, and rarely think about equivalence for depth of field. Macro excluded - that's always a special case here 😛.

For group photos taken indoors, I will likely need a wide field of view. I may use 14mm for micro four-thirds. I might use 28mm on my full-frame.

I'll probably shoot both kit zooms wide open at F4, and not care about depth of field, because the kit lenses are slow enough not to worry.

I love the shallow depth of field I can get with the A7II and a 50mm F1.4, but I'm also satisfied with what I can get (at least most of the time) with my micro four-thirds Panasonic G9 and some manual glass. I really love to melt messy backgrounds, and some speed-boosted primes are enough to do that.


Relatively cheap speed...

Canon 55mm F1.2 S.S.C. FD remounted to EF on Metabones focal reducer, 39mm F0.86.

Nikon 35mm F1.4 AI-s, adapted to Canon EF, on Pixco focal reducer, 25mm F1.0.



FOV Equivalence Table:


FFAPS-CM43
sensor width3623.6017.30
sensor height2415.7013.00
x/FF1.000.430.26


Full FrameAPS-CM43
Focal LengthFOV horizontalFOV verticalFOV horizontalFOV verticalFOV horizontalFOV vertical
12112.6290.0089.0466.3871.5756.89
14104.2581.2080.2558.5663.4249.81
1696.7373.7472.8252.2756.7944.22
2083.9761.9361.0842.8646.7836.01
2473.7453.1352.3636.2239.6430.31
3554.4337.8537.2625.2827.7621.04
4543.6029.8629.3919.7921.7616.44
5039.6026.9926.5617.8519.6314.81
8523.9116.0715.8110.5511.628.75
13515.1910.169.996.667.335.51
20010.296.876.754.504.953.72
3006.874.584.503.003.302.48
4005.153.443.382.252.481.86
6003.442.292.251.501.651.24
8002.581.721.691.121.240.93
10002.061.381.350.900.990.74
12501.651.101.080.720.790.60


How to calculate the Field of view? Trigonometry!
e.g.





Light...:

A 50mm F1.4 lens is a 50mm F1.4 lens no matter what sensor is behind it. The concentration of light is based on the F-stop. If the concentration is constant, then the larger sensor will gather proportionally more light information - and hopefully deliver less noise.

Let's consider a 25mm F1.4 on a micro four-thirds sensor, and a 50mm F2.8 on a full-frame sensor. The 25mm F1.4 makes a smaller image circle that's 4 times brighter than the 50mm F2.8. The full frame sensor gets less light per unit area, but it's four times the area. When looking at light, it's equivalent.

To get the same exposure, you'll need to bump ISO up to four times that of the micro four-thirds camera. 

The question then is "Can it handle four times the ISO?"

That depends!😛... but it normally doesn't matter. Why would I restrict myself to 2.8 when I can get a cheap 1.8? If I buy a 300mm lens on micro four-thirds, I'll need a 600mm on full frame - that's for FOV. If I don't, my subject would be a fraction of the frame. Common lenses for either system though would probably have an aperture of F5.6 or so. I wouldn't need to step down to F11 simply for an equivalence argument.

The question now becomes "How much higher can I push ISO?"

The answer isn't so simple as "4". It depends on several things- the pixel density of the sensor. The technology used. Circuitry...

Take a look at dpreview's comparison tool. The A7iii I've added on here has the same sensor size as the A7Rii. The higher noise on the A7Rii is likely a result of much higher pixel density. Swapping one of these to show how an older micro four-thirds sensor compares to a new one, it's obvious that other than size, technological developments also affect noise. The old E-M10 and slightly newer GM1 have the same sensor size as the OM1, but are far noisier. 

If you're looking at different sensor sizes and considering the idea of "light equivalence" then consider why. If it's for ISO sensitivity, then yes, a larger sensor helps, but it's only a part of the equation.



My shooting habits:

I've recently acquired an A7R.2 (full-frame) and 35mm F1.8 as my main walkabout camera. My Olympus E-M1.3 has been relegated to wildlife and macro. Compared to using the Olympus micro four-thirds with a 17mm F1.8, the 35mm F1.8 is used similarly. I do note the depth of field difference though. I find myself stopping down on the full-frame 35mm F1.8 for more depth when shooting multiple people or if I want to get more of the background. I also note the much better noise handling and the RAW files are easier to manipulate. An Older full-frame camera like this can certainly be worth it, but it's at the expense of newer autofocus, movie capture, touch-screens, buttons for control, more capable image stabilization etc.

But I take a look at a tough shot and work on the RAW file, and the results simply say "worth it".