Jump to content
 

CHDK Focus stacking, USB Remote Shutter


Alister_G
 Share

Recommended Posts

  • RMweb Gold

CHDK stands for Canon Hackers Development Kit. It is an alternative firmware that can be loaded and run on various models of Canon cameras, to enhance the features available from the camera.

 

The software is written by a community of individuals, and is non-damaging to the cameras, and does not overwrite the original firmware. It is simply loaded onto the camera's SD card, and run from there. If you put a normal SD card in, the camera reverts to its original software.

 

I have a Canon PowerShot SX620 HS, which has recently been added to the CHDK list of supported cameras, so I have downloaded and installed CHDK.

 

I have been experimenting with Focus-stacking and other features, so this thread will document some of those.

 

Al

Edited by Alister_G
Changed to explain what CHDK does.
Link to post
Share on other sites

  • RMweb Gold

I thought I'd post an answer, as I've been experimenting and learning how to do this.

 

There is a downloadable script on the CHDK website called, appropriately, foc_stak.lua which when run allows you to set the Depth of field extremes (near and far) by pointing the camera and pressing "SET" then you frame your shot and let it go. It takes a configurable number of shots, incrementing the depth-of-field and focal length for each shot. you can then stack the resulting images using software. I used HeliconFocus for this attempt, but CombineZP and Photoshop also do the same job.

 

Here's the results.

 

First, a shot using the normal camera settings, without any CHDK enhancements, taken in Macro mode using the standard autofocus. This camera doesn't have a manual focus setting at all.

 

ladmanlow1283.jpg.3fea6603307ece5eb746bbd9ff02f692.jpg

 

Not my finest shot, I think you will agree.

 

Next, framing the same image, with 5 incremental shots, and then stacking the result:

 

ladmanlow1284.jpg.2a342ba564e005efb8208378849aa944.jpg

 

You can see that I didn't correctly set the "Far" point, so it ran out of steam before it got to the end of the loco, but I think you'll agree that the rest is a vast improvement.

 

I will play with this further to learn how to do it properly.

 

Thanks.

 

Al.

Link to post
Share on other sites

  • Moderators

I had hoped to get to pass on some useful pointers today but it never happened, sorry Al.

 

I can see where you're heading and hopefully I can help. Hope to do so tomorrow!

Link to post
Share on other sites

  • Moderators

Sorry for the delay Al!

 

I use CHDK all the time but with manual parameters rather than the scripts. However, having looked at the manual for your camera following your comment about it not having manual focus, I think you are better with the scripts as you can't manually set your first focus point.

 

Assuming you have more control within the script than the five images you said you'd blended it's important to look at what physical range within the model, and beyond, that you want to have in focus. As you said you hadn't let the far point run to a long enough distance. The critical part though is what's nearest to the lens, i.e. the first point you want in focus and you were probably only an inch or two away from the brake at the right-hand side.

 

I'm not sure how close your lens will focus but generally it will be able to be a shorter distance the wider the angle you have the zoom set to. At this near end of the range the depth-of-field between shots is also critical and very limited - the stacking software searches for sharpest pixel edging and where it struggles it fudges things leading to out of focus areas between diffrent distances from the lens. hence, it's necessary to get the intervals right at the closest points.

 

The diagram below shows how this range of what's in focus increases over distance.

 

 DoF.jpg

 

Therefore, looking at your pictures above you would ideally like the camera to capture shots in the 30mm - 300mm range increasing by 30mm increments to stand a chance of getting what you'd really need. If you want to get all the background to infinity in focus you'd have to leave the camera rattling away for quite a while.

 

Now, considering the diagram above you wouldn't need all of those shots to chuck into the stacking software, just enough that cover all of the focal range you wish to achieve. If I were photographing your layout for instance I would set my increments to about 50mm and run a series of shots from 50mm - 1500mm (so about 30 in total) down the length of the layout and pick out the ones I want to stack.

 

Broadly I'd select the individual shots which are focussed at theses distances: 50mm, 100mm, 150mm, 200mm, 250mm, 300mm, 400mm, 550mm, 750mm, 1000mm and 1500mm so I'd be stacking eleven out of the thirty images taken just to save processing time.

 

What I can't say from this end is how easy that is to do with the parameters you can ask the script to do but that's where I'd be heading next.

 

Hope it helps a bit, keep us posted!

  • Like 1
  • Informative/Useful 1
Link to post
Share on other sites

I saw this being done by a professional photographer of model railways. He didn't use any software in the camera, but used a business card! He focused (using auto focus) on a business card at a certain distance, then took further pictures at larger distances.

  • Like 1
  • Informative/Useful 1
Link to post
Share on other sites

  • RMweb Gold

That's brilliant Andy, thanks very much for taking the time to do that.

 

For the shots above, the brakevan nearest the camera was about 20mm away from the end of the lens - one reason I picked this camera model was because of the very good Macro abilities of the lens - so I will experiment further with what you suggest, starting at 20mm and incrementing in 50mm steps and see how that goes.

 

Al.

 

 

Edited by Alister_G
  • Like 1
Link to post
Share on other sites

4 hours ago, Tim V said:

I saw this being done by a professional photographer of model railways. He didn't use any software in the camera, but used a business card! He focused (using auto focus) on a business card at a certain distance, then took further pictures at larger distances.

Tim,

I can see that the use of a printed card or other object to set the focus would be easier than trying to find a spot on the model to set the focus to.

Link to post
Share on other sites

I have been playing with my camera this morning. I have previous experimented with Focus Stacking but had not been very successful. Today by using a 'sighting object' to set the focus for each slice I have produced waht I could consider to be a satifactory result.

Equipment Used: SLR camera on a tripod, a section of model railway complete with a loco and 4 wagons, a sighting object - a short ruler held in a clip, photo manipulating software - GIMP (2-10-20 rev.1)

 

Process:
Set up equipment

Take some pictures to get the camera settings right. SEt camer shutter to 2 seconds delay. From now on the camera and rolling stock must not move

Take a genreal reference picture.

Place sighting object (SO) at front of loco. Manually focus camera, remove SO, take picture

Reset SO at front of first wagon, focus camera, remove SO, take picture,

Repeat, repeat.

 

Download pictures to camera

Select pictures to use for stacking

Open first picture in editing software

Open 2nd picture in editing software. Select slice of photo using rectangle select tool. Copy Visible.
Go to 1st Picture and Using Edit, Paste AS New Layer/Paste in Place command add slice to 1st picture.

Repeat for as many slices as required.

 

For my basic image it took no more than 20  minutes to do the manual stacking. I then messed about for a bit longer trying to improve the focus of the foreground grass. In hindsight I should have coinsidered this as part of the whole process.

Picture 1 Basic Image
Picture 2 Focusing Object

Picture 3 Focus Stacked Image

2020_07_03_011_cropped.JPG

2020_07_03_009_cropped.JPG

 

2020_07_03_011_stacked_cropped.jpg

Edited by Tanllan
Incorrect Picture 3 replaced
  • Like 2
Link to post
Share on other sites

  • RMweb Gold

One of the other features of the CHDK is to allow me to use a remote shutter release - again something that the standard camera doesn't offer.

 

Using the USB connection, normally used for downloading files off the camera, it is possible to focus and shoot remotely. All that is required is a battery, a push button, and some way of connecting it together.

 

I bought the following items:

 

1 x HH-066-0-0-G-0 HAND HELD ENCLOSURE

1 x BATTERY HOLDER, COIN CELL, CR2032, PCB MOUNT

1 x 59-511 SWITCH, PUSH, SPNO, MOM, PLASTIC, BLACK

1 x PSG3299 USB 2.0 PANEL MOUNT A ADAPTOR LEAD 1M

1 x USBAUB1MU LEAD, USB A TO UP ANGLE MICRO B, 1M

2 x CR2032 BUTTON CELL, LITH 2032 3V

 

The panel mount Female USB "A" socket, along with the USB Micro-B to A lead, connects the handheld enclosure to the camera.

 

canon-remote003.jpg.bbaa2c1a817de0a44cf0e54d98b4e26a.jpg

 

I had to carve away some of the plastic from the top and bottom of this to get it to fit snugly in the case. A piece of black styrene was shaped and drilled to accept it and hold it in the front of the case.

 

The panel mount adapter comes with a lead with another "A" socket on the other end, so this was cut off, and the cable stripped back to reveal the individual conductors. All we want are the 5V power (red) and ground (black), the other wires (green and white) were cut off.

 

canon-remote004.jpg.06976d9961e9cf5f74ca91d7290b5952.jpg

 

The battery cell holder was soldered to a small strip of vero-board, just to make it easier to mount, and connect the wires. Sticky foam pads were used to stick this to the inside of the case.

 

canon-remote005.jpg.de092a563f92a367a3eec4cb14cd00c2.jpg

 

The positive from the battery goes to the switch, which is mounted through a 13mm hole in the top of the case. It is a non-latching momentary action switch: that means it is on when pressed and held, and off when released.

 

canon-remote006.jpg.a218ceacaefad0cd50d89209dc126165.jpg

 

The positive wire then goes from the switch to the USB socket, and the ground or negative goes direct to the socket from the battery holder.

 

I initially used a single CR2032 3V battery, but found that this was not powerful enough to trigger the shutter, so I doubled them up to use 2 CR2032, which when testing I found to produce 5.65 Volts. The camera expects to see 5V so for the momentary action which is used I deemed it safe at that voltage.

 

Here's what it looks like assembled:

 

canon-remote002.jpg.2f0366f59c6d53ab3a3cc6e9a54d7468.jpg

 

and connected to the camera by the USB Micro-B to A lead. I chose a 90degree angled one, which is slightly more expensive:

 

canon-remote001.jpg.5874277ed2e9b80f705b633269fb95f1.jpg

 

in the CHDK Settings Menu on the camera, you can turn on the USB Remote Shutter. It's worth noting that whilst this is turned on, you can't use the USB socket for transferring files, and if you plug the camera into your computer, it will fire the shutter! So remembering to turn it off is advisable.

 

canon-remote007.jpg.991edad71d7cf0a91766904af41cdc35.jpg

 

You can choose from a couple of options as to how it works:

 

OnePush : when the button on the remote is pressed it triggers the Half-Press position - to activate auto-focus, etc - and then when the button is released it triggers the Full-Press and takes the photo.

 

TwoPush : the first click and release of the button on the remote triggers Half-Press, and a subsequent second click and release within half a second triggers Full-Press.

 

So far I've found the OnePush to work fine.

 

Total cost of bits was about £20.00 including delivery, and it took a couple of hours to assemble - most of which was cutting out the styrene to mount the USB socket!

 

I hope this is of interest to any other Canon camera owners.

 

Thanks for looking,

 

Al.

  • Craftsmanship/clever 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...