Camera independent pixel-shift possible?

A forum to ask questions, post setups, and generally discuss anything having to do with photomacrography and photomicroscopy.

Moderators: rjlittlefield, ChrisR, Chris S., Pau

JohnyM
Posts: 463
Joined: Tue Dec 24, 2013 7:02 am

Camera independent pixel-shift possible?

Post by JohnyM »

Hello!
Right now, im in the process of building my ultimate (I hope!) horizontal rig. Should wrap up initial phase in about a month, so i can move on to dia-illumination part.

It have the option to stack and stich by camera movement with 1um resolution, expandable to 0,25um if needed (currently only Z axis for NA of 0.5 and higher). Can move just the camera with lens fixed or whole camera-optics block, with subject and light remaining stationary.

XY axes will have 30mm travel, which is good for ~1x 2x2 panoramas and higher magnifications (APS-C), but it just occured to me, that with 1um axis resolution i could make 4x4 samples per pixel for ~4um Sony A6300 sensor for under 1x magnifications (rig is made for up to 700mm working distance with DIA-illumination block removed).

Is there any software that could manage those files for super-resolution technique like found in some m4/3 bodies?

Best thing i can think of is batch split each image into RGB channels, stack them and then merge back in PS. I would expect this process to increase color acutance (like in A7RIII or Pentax K) but not necesary resolution?

Other thing, is stack the images with average weight, which should result in better detail and resolution, but would be a nightmare to process. (camera raw -> ImageJ -> Zerene -> Photoshop)

If there is, i'll have to learn arduino for controlling stepper motors, which i try to grasp for years but still fail to do so :?

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

John,

I haven't done any programming in over 40 years, so this is all new to me also!!

If you decide to do this stepper motor control look into the Raspberry Pi as the commanding computer, these are amazingly complete little computers with lots of useful features and cost only $35 for the 3B or 3B+ versions. The 3B+ has four 64 bit Arm cores at 1.4GHz, 4 USB ports, HDMI and WiFi & Bluetooth. They us a micro SD card to load the OS and programs. Sure it's way overkill, but for $35 hard to argue!!

For the stepper controllers the TI devices (DRV8825 for example) evidently have some highly non-linear behavior when micro-stepping, I'm using a MPS6500 for this reason. I had already purchased 5 of the TI boards before I found this out :? The MPS6500 also has a PWM mode which returns some of the motor inductive coil current to the supply rather than dumping it all to ground and thus wasting power. The actual supply current is much smaller than the actual motor current set limit.

Putting together a Precision S&S system based upon 2 THK KR15s to move the subject (X & Y axis), and a THK KR20 or KR26 to move the camera/lens (Z axis) when a vertical setup is used. The same setup with a precision Thor Labs proper optical 95mm mounting system, or a modified WeMacro Vertical Stand that can be used vertically or horizontally in either case.

Everything is playing nicely together and just putting some parameter storage/recall capability in the code (Python) now.

Good luck with your setup and keep us posted,

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

mawyatt wrote:For the stepper controllers the TI devices (DRV8825 for example) evidently have some highly non-linear behavior when micro-stepping, I'm using a MPS6500 for this reason.
I expect the linearity varies depending on which motor you use it with.

In any case, if the nonlinearity is repeatable then you might consider calibrating it out, with a lookup table to translate between the physical position you want and the nominal microstep needed to get there.

--Rik

ray_parkhurst
Posts: 3417
Joined: Sat Nov 20, 2010 10:40 am
Location: Santa Clara, CA, USA
Contact:

Post by ray_parkhurst »

rjlittlefield wrote:
mawyatt wrote:For the stepper controllers the TI devices (DRV8825 for example) evidently have some highly non-linear behavior when micro-stepping, I'm using a MPS6500 for this reason.
I expect the linearity varies depending on which motor you use it with.

In any case, if the nonlinearity is repeatable then you might consider calibrating it out, with a lookup table to translate between the physical position you want and the nominal microstep needed to get there.

--Rik
Linearity also depends on load, friction, and maybe a few other things that would make lookup table-based calibration difficult or even impossible. There of course might be some tricky "local" methods that would optimize the system for the subpixel steps.

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

Rik, Ray,

Here's an example of the Ti DRV8825 I mentioned, note how bad it misbehaves even without a load!! I doubt you could reliably correct this kind of misbehavior, and why I moved on the the MPS6500.

https://hackaday.com/2016/08/29/how-acc ... ng-really/

Best,
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

rjlittlefield
Site Admin
Posts: 23564
Joined: Tue Aug 01, 2006 8:34 am
Location: Richland, Washington State, USA
Contact:

Post by rjlittlefield »

mawyatt wrote:Here's an example of the Ti DRV8825 I mentioned, note how bad it misbehaves even without a load!!
Heh! That looks pretty much like a StackShot in low precision mode. There, the nonlinearity appeared when the drive current was set too low, for "holding torque". The solution was to increase the minimum drive current, which is why high precision mode also makes noise and the motor gets warm. I have no idea what driver was involved.

--Rik

Pau
Site Admin
Posts: 6053
Joined: Wed Jan 20, 2010 8:57 am
Location: Valencia, Spain

Post by Pau »

I guess that to have enough precision and no backlash for pixel shifting you would be better served with piezo actuators.
Pau

enricosavazzi
Posts: 1474
Joined: Sat Nov 21, 2009 2:41 pm
Location: Västerås, Sweden
Contact:

Post by enricosavazzi »

Pau wrote:I guess that to have enough precision and no backlash for pixel shifting you would be better served with piezo actuators.
I agree, for fractional pixel shifts the total amount of travel is less than about 5 microns (if shifting is done at the camera - the alternative being shifting the subject stage), which makes stepper motors overkill in terms of total travel capabilities and not precise enough.

A camera support or subject stage with flexures would also work better than rails and sliders.
--ES

ray_parkhurst
Posts: 3417
Joined: Sat Nov 20, 2010 10:40 am
Location: Santa Clara, CA, USA
Contact:

Post by ray_parkhurst »

Pau wrote:I guess that to have enough precision and no backlash for pixel shifting you would be better served with piezo actuators.
Or voice coils.

JohnyM
Posts: 463
Joined: Tue Dec 24, 2013 7:02 am

Post by JohnyM »

@mawyatt
I've decided to stick to wemacro controller for controlling the motor for now. They've said 3-axis controller is WIP, and there also will be software doing that with 3x ordinary controller. Signle controller will have the advantage of using single USB vs 3x USB ports.

My reasons for that is pricing and uniformity (got 3 wemacro rails and some home brew "micromates" on few devices already).

I'll update the topic when i put it all together. Over 800 individual parts to put together! I feel like kid playing with bricks again :lol: !

Setup for now is:
-Wemacro rail as mm / um Z stepper with idler rail above it.
-Sub um Z stepper still in design stage (got one for vertical, now need to think how to make it horizontal).
-Thk KR1501A mounted horizontally for X axis - spring loaded idler rail above.
-Thk KR1501A mounted vertically for Y axis - idler rail in form of 4 spring loaded columns supporting the stage.

@Pau & enricosavazzi
Every rail is (will be) mounted to idler rail and spring loaded. Shouldnt that take care of backlash?

As an alternative, subject is mounted ( is! that's already done ) on 6 axis manual micrometric stage, so i could do it manually. But lights are fixed on independent rails and will not move when subject will. So that's a thing to reconsider.

@everyone - returning to original question:
https://www.dpreview.com/articles/07276 ... any-camera
This method looks interesting. When comparing 4 image to "oversharpened" i can see much less noice, but not really any more details.

Processed image was both: first blown up to 200% then resized back to original size, and image was shifted without any controll. I wonder how well would it work with precise shift and no downsizing. After all it's just simple 25% opacity that could be eazily automated in PS.

ray_parkhurst
Posts: 3417
Joined: Sat Nov 20, 2010 10:40 am
Location: Santa Clara, CA, USA
Contact:

Post by ray_parkhurst »

JohnyM wrote: @everyone - returning to original question:
https://www.dpreview.com/articles/07276 ... any-camera
This method looks interesting. When comparing 4 image to "oversharpened" i can see much less noice, but not really any more details.

Processed image was both: first blown up to 200% then resized back to original size, and image was shifted without any controll. I wonder how well would it work with precise shift and no downsizing. After all it's just simple 25% opacity that could be eazily automated in PS.
JohnyM...the "Super Resolution" method does indeed work, but one thing you may not realize is that sub-pixel shifts are not required. The SR algos only require that the images are offset from each other by non-integer numbers of pixels. I was successful in making the technique work with manual steps on order of ~10um, with no regard to sub-pixel alignments. This means for SR you don't need to worry about accuracy of sub-pixel movement, only that the movement is non-integer vs pixel pitch.

mawyatt
Posts: 2497
Joined: Thu Aug 22, 2013 6:54 pm
Location: Clearwater, Florida

Post by mawyatt »

JohnyM wrote:@mawyatt
I've decided to stick to wemacro controller for controlling the motor for now. They've said 3-axis controller is WIP, and there also will be software doing that with 3x ordinary controller. Signle controller will have the advantage of using single USB vs 3x USB ports.

My reasons for that is pricing and uniformity (got 3 wemacro rails and some home brew "micromates" on few devices already).

I'll update the topic when i put it all together. Over 800 individual parts to put together! I feel like kid playing with bricks again :lol: !

Setup for now is:
-Wemacro rail as mm / um Z stepper with idler rail above it.
-Sub um Z stepper still in design stage (got one for vertical, now need to think how to make it horizontal).
-Thk KR1501A mounted horizontally for X axis - spring loaded idler rail above.
-Thk KR1501A mounted vertically for Y axis - idler rail in form of 4 spring loaded columns supporting the stage.
The USB ports use for the 3 axis controller isn't a problem since I now use (not shown though) a 4X USB expander which takes up only one USB port on the Raspberry Pi but expands it to 4 ports. Stacking and Stitching isn't very fast so no issues with speed and the stepper driver micro controllers take care of motor interfaces.

The Wemacro rail and controller are certainly good enough, probably the best value overall focus stacking rail setup available, I know I have and use them a lot!!

I've been able to use the Stack & Stitch setup I'm developing on the Wemacro Vertical Stand, in either the normal vertical or horizontal mode. This creates a very compact and portable Stack & Stitch system. Just some slight modifications and additional parts are required. Your two KR15s will fit nicely on the Vertical Stand stage base to move the subject in X and Y axis and the Wemacro focus rail obviously fits on the vertical bar Z axis since that's what the stand was designed for!!

The two KR15 are bolted together with low head profile very short M3 bolts. The mount spacing is 14mm which is what the USA KR15 stage plate spacing is and it's tapped for M3, convenient!! The bottom KR15 has a long ARCA clamp attached by drilling and tapping 4 M3 holes in the ARCA clamp using low profile M3 bolts. A long ARCA plate is attached to the Wemacro Vertical Stand bottom base directly or indirectly via a large adapter plate. I've used 4 M5 bolts to hold the ARCA plate to the base by drilling and tapping the base for M5 bolts. The two KR15s now slide onto the ARCA plate on the Wemacro base for coarse Y positioning which is needed because of the different lens assemblies I use (PN105, various extension tubes & mounts, Mittys with various tube lenses, Nikon & Canon Bellows, and standard Macro lens.

For Weamcro Stand horizontal use, get a longer 40mm bar (600~700mm) from Misumi. Wemacro has a horizontal option with the Vertical Stand and get an additional M8 adapter. Use the additional M8 adapter as shown under the horizontal bar to the base. I'll be drilling a hole in the vertical ARCA plate to allow it to also bolt directly to the Misumi 40mm bar (haven't done this yet thought). Slide the two KR15s onto the vertical ARCA plate for coarse Z positioning, and the Wemacro rail mounts to the Misumi 40mm bar as usual (you'll need to drill a few attachment holes like in the standard supplied Wemacro 40mm bar).

Anyway, hope this helps describe a possible method for a small, portable Stack & Stitch setup based upon the Weamcro Vertical Stand and a couple THK KR15s.

Best,

Image
Image
Image
Last edited by mawyatt on Wed Nov 07, 2018 9:43 am, edited 1 time in total.
Research is like a treasure hunt, you don't know where to look or what you'll find!
~Mike

Lou Jost
Posts: 5948
Joined: Fri Sep 04, 2015 7:03 am
Location: Ecuador
Contact:

Post by Lou Jost »

Precision sub-pixel shifts buy you fewer shots per gain in resolution. Eight shots more than doubles the resolution in megapixels. I don't know how many random shots would be required to do that, but it ought to be more than eight.

ray_parkhurst
Posts: 3417
Joined: Sat Nov 20, 2010 10:40 am
Location: Santa Clara, CA, USA
Contact:

Post by ray_parkhurst »

Lou Jost wrote:Precision sub-pixel shifts buy you fewer shots per gain in resolution. Eight shots more than doubles the resolution in megapixels. I don't know how many random shots would be required to do that, but it ought to be more than eight.
From what I found in my testing, resolution improvment with the SR method (at least using one program to do it) topped-out around 6-8 images. Above that I saw no improvement, the final images were basically unchanged.

Another point that may not be obvious is that the optics used for SR method (or any pixel-shift method) must be able to support the higher resolution. You won't get much improvement in resolution if you are already diffraction-limited. That said, the technique does help with noise, so that may be a benefit even with diffraction-limited optics.

In my testing, I was not looking for an increased image size, only for improvement in sharpness/color fidelity/noise for the same image size. I did not like the look of the 2x images at all, but when downsized to the original size, there was clear improvement.

Adalbert
Posts: 2428
Joined: Mon Nov 30, 2015 1:09 pm

Post by Adalbert »

Hi Johny,
Please take a look at ( arduino c++):
https://www.photomacrography.net/forum/ ... highlight=
BR, ADi

Post Reply Previous topicNext topic