Category Archives: Photography

Technaxx TX-158 Microscope Review

I just got this idea that I want a Microscope. There are very many to choose from, and the prices vary much as well. I have no professional or real need of a Microscope, I am just a nerd. One thing I wanted to do is to have a close look at my Elemental Dice.

When I was quite young I had a childrens microscope that was 100x, 200x, 300x magnification. It was not so easy to use, and obviously it was not capable of capturing digital pictures. After doing some research I decided to buy a very simple cheap USB/Wifi microscope, knowing that it would probably not be so amazing.

Technaxx TX-158 basics according to marketing:

  • Live view for PC or smartphone (so I can use my iPad as a screen)
  • Photo/Video (I just care about photo)
  • With a stand
  • LED illumination
  • Magnification up to 1000x (as I see it, it is max 40x magnificaiton, see below)
  • Full HD resolution

This is mostly true. What is absolutely not true is 1000x magnification. The stand is on the cheap (light, flappy) side. The pictures are 1920×1080 and then the question is: are they that sharp? You will see for yourself below. All pictures below are straight from the TX-158, no editing.

Basic usage and features

It is easy to get started (with iOS, only thing I tried).

  1. Charge it using USB (cable but no power supply included)
  2. Download the iWeiCamera App from Apple App Store.
  3. Turn TX-158 on.
  4. Connect your iOS device to the unencrypted WiFi network called Cam-something
  5. Start iWeiCamera
  6. Use the wheel on TX-158 to focus
  7. Use the button in the App or on TX-158 to take a picture.

That is kind of it. You export the pictures from the iWeiCamera to Photos (in iOS), and then send them to your Mac with AirDrop (or something else you find convenient).

Optical Capability

TX-158 has 8 LED lights that can be adjusted (pressing the on-button repeatedly). This is convenient. It also has a transparant plastic shell around the lens. I have found that the shortest possible focal depth is “kind of” the distance you get if you place TX-158 on a surface. You may be able to focus on something that is slightly closer, but not much. If a small coin fits inside the plastics shell you are probably fine. My 16mm dice also fit inside, that does not work.

You may however photograph items more far away. This picture of a 16mm metal die is taken (horizontally) from almost 10cm (click the image to open the full resolution).

The noise around/behind the die looks a bit strange, but it is probably reasonable given how I mounted the die between white postit notes. If I open this picture on my computer display the object is about 16cm large (with no digital zoom). The actual object is 16mm, so to me this is about 10x magnification.

I then moved the die as close as possible and focused on “13” in the top left corner.

I would say this picture is about 4x more magnified than the previous one (just measuring the height of “13”.). Compared to the real object I would say we have about 30-40 times magnification. Anything “more” than that is just digital zoom, and I do not think the picture quality allows for much digital zoom.

Zoom & Focus

The box that comes with TX-158 states on the backside: “Up to 1000x magnification / Magnification adjustable with turning wheel”. In the little booklet however I read: “Zooming: turn the focus wheel until you reach the personal best view option”. So it is a focus wheel and the marketing about “adjustable magnification” is a lie. The good thing is that it is obviously a “fixed” or “prime” lens which is better for image quality than a zoom lens. Adjusting magnification is easy (within 10-40x something) by simply moving the TX-158 closer or more far away from the object. But when the object gets too close to the lens it can not focus anymore.

The little booklet also mentions Autofocus. I am not 100% sure, but I don’t think it has any autofocus.

More pictures

All the below pictures are taken by simply placing the TX-158 on top of whatever I photograph and manually adjusting the focus.

Dust on a plastic surface
The surface of a worn Teflon or Ceramic frying pan

An oiled wooden table

One of my hairs
Worn wooden surface
A leaf, cut off from a pineapple (stainless surface at top of picture)
A blanket made of wool
Fake/faux leather
A piece of dirt – wax from a cheese probably – on a stainless surface
A piece of linen cloth
The text TECHNAXX, on the image of TX-158 printed on the box it came in
3cm mark on an aluminium ruler (the lines to the right are mm lines)
A drop of honey on what I thought was a black metal surface (the 8 LED lights reflect in the drop)
An iPhone connector
Tip of a knife
Grains of salt in a blue porceline bowl
A safety match
Letters svERige on a coin


After having played with an analog childrens microscope at 100-300x when I was little, I kind of hesitate to call the TX-158 a microscope at all. To me it is more a macro-photo-camera.

When you get to “real” 300x magnification you can start seing things that this device do not at all reveal. I would say it is 40x magnification (and then I am quite generous), but perhaps that is the wrong way to measure it.

The practical thing is that 40x is not THAT much, so it is quite easy to move around the TX-158, find your object and adjust the location of things manually. For a higher magnification you probably need a much more stable stand, and being able to move the microscope or the sample in a controlled way. TX-158 is more point and shoot.

Anyway, when you read about different microscopes for sale on Amazon and other places, if it mentions magnification in the range of 1000x, just do not trust it. I doubt any real microscope can be 100-1000x magnification or anything like that.

The iWeiCamera-App is very rudimentary. Copying images from the App to Photos gives me a message in Chineese. But connecting the iPad via WiFi and getting started is very simple.

I guess for soldering work or other very delicate work, it is a useful digital magnification glass. Then the stand probably more comes to its right too.

Camera HDR vs Graduated ND filter

Sometimes when I take photos I have a rather dark ground and a rather light sky. The consequence is that the sky gets overexposed and the ground underexposed. There are remedies. HDR means digitally improving the image, often after taking several images with different exposure times. A gradeduated ND filter is a physical camera filter that is half completely transparant, and half greyish.

I have a Sony RX100Va and I decided to compare the two methods. When using HDR this camera produces two images: the original unprocessed and the HDR-improved one. So the first two columns below are produced in one shot. The third column is a separate shot, with the filter attached to the camera.

If you open the images in a new window/tab you get higher resolution.

No HDR, No Graduated filterHDR, No Graduated filterNo HDR, Graduated filter ND8

There is obviously a difference, and in the end it depends on what you want. I find that the HDR-feature of my RX100Va camera is not as powerful as a Graduated ND8 filter. However the filter goes from light to darker, while HDR is obviously can do its job even if it is not an horizon in the image (for example if you photograph into a dark window but also want the exterior). If you look at the tree of the top-right GND image, it is very dark in the top. The HD-images have a bit more vivid green, I don’t know if that is an advantage.

To attach a filter to my RX100 I bought a MAGFILTER. So far I am very happy. The filter used above is a 52mm URTH Graduated ND8.

Note (to self if nothing else): In Swedish Graduated is translated into Graduerat or Halvtonat.

Turn off VR when using a tripod

I have found that (when using my Nikon Coolpix P7000) pictures get sharper when I turn off VR (Vibration Reduction), for long exposure times and when using a tripod.



Both pictures are 10 seconds, f/5.6, ISO 100, 200mm with my Nikon P7000. The orchide is lit up only by a candle. The left one is the sharpest of three attempts, with VR turned on. The right one is the first attempt with VR turned off. Obviously a tripod was used.

Photographing a model backdrop

I decided my model train layout (Märklin Z) needed proper background image (a backdrop). If you google for it, you find many nice backdrops for sale. Those are probably fantastic, but I did not find one that works for me.

I will start with the result.


This is a panorama that is 180×15 cm, and most standard backdrops I found were not so extreme panoramas as I wanted. Also, when making it myself I could get the landscape I wanted.

This is what you need:

  1. A location with unobstructed view over the horizon
  2. Good weather conditions, preferably the sun in your back
  3. A tripod

And of course, you need a camera. I made use of the following features of my Nikon P7000 when photographing my panorama.

  1. RAW mode (to ensure white balance etc are identical for all pictures)
  2. Delayed shutter or remote shutter (to keep camera absolutely still)
  3. Manual mode (you want the same shutter speed and aperture for each picture
  4. Grid 3×3 (to help with proper overlap
  5. Horizontal indicator (to help getting the horizon straight
  6. 200 mm equivalent zoom (to be able to take several pictures at a limited horizon stretch)

I only rotated the camera using the tripod between each picture, keeping the horizon exactly in the middle of the pictures, and I let the pictures overlap 1/3.

Essentially, the math goes like this. I wanted at least about 150-200 dpi for my final print of 180 cm. This requires a picture that is about 15000 pixels wide. Ideally I would use a camera with 15000×10000 pixel sensor (that is 150MPixels) and just crop the picture. I have no such camera, but my Nikon P7000 is about 3600 pixels wide. With an overlap of 1/3, it means each picture contributes with only 2400 pixels, so I need a series of about 6 pictures to get a 15000 pixels wide result. Now this is where telezoom comes into play. At 200mm, each picture is about 10 degrees. The more telezoom you can get, the shorter horizon you can work with.

Dont overexpose! You want the sky blue – not white. If you have UV filters and stuff – great. But I suggest you underexpose a bit.

Panorama stiching
I used Ubuntu and tools that come with it to create my panorama.

First I imported all my series into Shotwell. That means, I let Shotwell do the RAW developing, which turned out ok (all pictures had the same white balance, etc) – perhaps I was just lucky. I picked my best series, and exported all pictures from that series at highest quality.

Second, I used Hugin Panorama Creator to create the actual panorama. I choose Lens Type = Panoramic (Cylindrical). This is a lie (and at 200mm it is a small lie), but it created the completely straight horizon I wanted.

Finally, I did some cropping and color adjustments in Gimp.

How to print something that is 180×15 cm? My first idea was to print several standard 15×10 cm photos and just display them next to each other. Problem is, you never know if the crop your pictures a little bit, and in this case it would destroy the result completely.

I ended up (in Gimp), cutting my 15000 pixel panorama into 3 pieces (each 60x15cm), and pasting the 3 pieces to a 5600×4000 image. I left white margins around each piece.

I then sent my single big picture to print on standard photo paper in 70x50cm. I cut out the 3 pieces with a razor and mounted them next to each other.

I did not have so high expectations. My plan was to learn from my first attempt and do everything over again a few times. But my first result was really above expectations – and very much good enough for my purpose.

You do not need higher DPI than I had (15000 pixels for 180 cm). You can probably do with less.

I am very happy with my sky (~RGB=135,166,186) and the sea colors (~RGB=32,63,97).

Printing on normal photo paper was good – the result is nice. The edges between them are not perfect though.

Nikon P7000 now supported

The Nikon P7000 camera is now supported by iPhoto. It also works in Shotwell 0.9.0 in Ubuntu 10.10. The NRW Raw files I mean.

Finding a Color Matrix for dcraw (and libraw)

Read this post first for a little background, if you need it.

So, a color matrix in the dcraw code looks like:

   { "NIKON COOLPIX P6000", 0, 0,
        { 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } },

Some cameras have four colors instead of three, and those cameras have a color matrix with twelve elements instead of nine.

As you can read on the homepage of dcraw under “Why does dcraw output have a green tint and weak color?”, the color matrix can be determined (with some procedure) if you (under correct conditions) photograph a sheet with reference colors. Obviously, we have to leave the digital world to do this. As I live in a part of the world where daylight is not very likely to occur for a few months, I decided to try to find my color matrix in another way.

My Strategy
Since I do have a computer with Nikons ViewNX program, I decided to try this strategy:

  1. Take a suitable photograph in RAW
  2. Export it to 16-bit TIFF using ViewNX
  3. Find a color matrix, that makes dcraw output a TIFF file equivalent to that from View NX

There were some challenges to overcome…

Little disclaimer
More things than the color matrix decide the result of dcraw. In particular, white balance (-a -A) and brightness (-W -b) matters a lot to the output. Thus, I have accepted that my color matrix does not produce exactly the same result as Nikons ViewNX.

Picture dimensions
ViewNX (and the camera) says full size is 3648×2736 pixels. But dcraw gives you 3664×2742 pixels. ImageMagick solves this with

  $ convert -crop 3648x2736+8+3 orig.tiff cropped.tiff

Choosing a good picture
I dont know, but I guess a good picture has many different colors in a fair distribution. If one color is missing the color matrix might fail to handle it well. I also (after initial tests) decided I wanted a slighly unsharp picture to avoid high contrasts between adjacent pixels. Pictures are noisy if you look closely at pixel level, and if that noise is the result of the Bayer filter (or something I dont know about) I dont want it to disturb my tests. I even decided to blur my picture (both reference and target of course) using ImageMagick again:

  $ convert -blur 12x4 pic-in.tiff pic-out.tiff

Here is the picture I used (feel free to tell me why it is unsuitable):

It was shot outdoors in something that some people would call daylight.

Deciding if a solution is good
I found a little program that could measure the difference/error between two images:

  $ imgcmp -f pict1.jpg -F pict2.jpg -m pae

If does not support tiff so I had to live with uncompressed 8-bit jpegs.

The mathematical solution
In the end I did what I tried to avoid first – I did the math of calculating a matrix instead of trying to search for it.

This mathematical solution requires a lot more understanding, so I couldnt start there anyway. First two sources: wikipedia on sRGB and a thread from someone who tried the same thing before me.

Now some bad news. RAW file uses 12-14 bits color depth. My NRW-files from my camera are about 15-20Mb. When converted to 16-bit TIFF, they turn 60Mb ( 3 colors X 2 bytes/color X 10Mpix ). Why is the RAW file much smaller? Because each pixel is EITHER red OR green OR blue! In fact 50% are green, 25% red and 25% blue. It is called Bayer Filter, and some cameras use different but similar methods. This line in the dcraw patch fixes this:

    filters = 0x94949494;

This is bad for two reasons:

  1. It feels like marketing bluff that a 10MPix-camera has just 2.5M sensors that read the color blue
  2. The first step dcraw has to perform is interpolation to fix this Bayer Filter, and it is possible (likely) that dcraw doesnt do it exacly the same way Nikon does, and the pictures will never be identical (yet equally good)

Next steps for dcraw are:

  1. apply our Color Matrix
  2. convert from RGB to sRGB
  3. apply gamma

I wanted dcraw to output right after interpolation. So, I invoked dcraw (a version without a color matrix for my camera) like:

  ./dcraw -T -o 0 -W -g 1 1 -c MYFILE.RAW > source.tiff

I cropped the file, and wrote a little c-program (using libtiff) that extracted a few hundred pixel values, from both this file and the values for the same pixels from the Nikon ViewNX tiff. (Sorry, I gave up on 16-bit tiff… libtiff doesnt support it).

Now some linear algebra (skip to the code below if you dont get this). I have those matrices:

  • V: pixel values from the Vendor file
  • R: pixel values from the Raw file (from dcraw)
  • S: the sRGB-to-RGB-matrix
  • C: My unknown color matrix

The values in V and R needs to be divided by 255.0 to move from [0-255] to [0.0-1.0] ranges. The values in V has to be fixed for gamma, so we get linear colors. Now we have

  C x S x V = R

Mathematically, in order to decide C, only three pixel are needed. I want more pixles. I tried with 9 selected and 200 “random”, and I got exactly the same answer. If we remember some linear algrebra from school and solve the equation for C, we get:

  C = ( inv( (SV)*(SV)' ) * SV * R' )'

Maybe it can be simplified, and the inverse does not need to be calculated… but I dont care now. I put everything into a little script for Scilab (Matlab for the poor – available as a package in all linux distros I have tried).

 215 230 254 ;
 223 176 101 ;
 236 140  98 ;
 247  68 107 ;
 168  87 156 ;
 106  94 165 ;
 100 200 254 ;
  63 171 140 ;
 124 188 126 ];

 88 168 98 ;
 70  78 19 ;
 68  57 16 ;
 63  35 13 ;
 31  29 20 ;
 15  26 20 ;
 26  95 74 ;
 14  54 21 ;
 28  69 22 ];

// Maybe change this one

// Dont edit below

// sRGB-to-RGB-matrix 
 0.412453 0.357580 0.180423 ; 
 0.212671 0.715160 0.072169;
 0.019334 0.119193 0.950227 ];

function x=srgb_gamma(y)
  for r = 1:rc(1)
    for c = 1:rc(2)
      z = y(r,c)
      if z <= 0.04045
        x(r,c) = z / 12.92
        x(r,c) = ( ( z + 0.055 ) / 1.055 ) ^ gammaval

function CM=find_color_matrix()
  // first move from 0-255 to 0.0-1.0 ranges, and transpose

  // second, undo gamma in vendor colors


  // Solve for CM, in  CM*S*N=R
  CMtmp=( inv( (SV)*(SV)' ) * SV * R' )'
  // dont talk to me about costs of inverting 3x3 matrices

  // fix output for dcraw
  CM=round(10000 .* CMtmp)

Now, just update VENDOR and SOURCE with your values, and call find_color_matrix(). In Scilab!

My first idea was to search for a matrix. Basically:

  1. Set a start matrix, calculate fitness
  2. Take a "step", obtain a new matrix, calculate new fitness
  3. If new is better, update best
  4. Goto 2

My plan was to iterate until the error was small (like Peak Absolute Error < 2 for each color). That didnt happen. No really close solutions. I tried linear combinations of the 200+ matrices already in dcraw. I tried random steps, steps in one or several directions.

Issue at ISO400+ with my dcraw-patch for Nikon Coolpix P7000

As I wrote earlier I patched dcraw to work with my Nikon Coolpix P7000. However, there seems to be some problems at ISO400 and above.

I made the same shot twice from a tripod, with the same settings (f/4.0, 1/30s). In the first case I used ISO100 and flash=1/4. In the second shot I used ISO400 and flash=1/16.

How to read it:

  • to the left: ISO100, developed from dcraw
  • to the right: ISO400, developed from dcraw
  • middle column: JPG from the camera ; if you look closely ISO100 in the left half and ISO400 in the right part
  • top row: dcraw with no processing switches activated
  • bottom row: dcraw called with -W, will not auto-bright the picture

So, after first concluding that brightness is tricky (but can be fixed/adjusted with the -b switch), lets look in the right column at those ISO400 pictures. Obviously they are too pink, and they also have a kind of foggy layer over them (I think).

Now, dcraw has a switch for “darkness” (-k). Have a look at the pictures below. I shot six raw pictures at ISO 100, 200, 400, 800, 1600 and 3200 (from top to bottom). I developed each picture four times with dcraw at darkness values 0, 128, 256 and 512 (from left to right).

As I see it, the right darkness value depends on the ISO value as in:

  ISO   Darkness
  100   0
  200   0
  400   256
  800   256
 1600   256
 3200   256

I need to think about an elegant patch for dcraw.
My patch for dcraw now fixes this problem as well.

Add Camera Support (Nikon P7000) to dcraw (and libraw)

I bought a Nikon Coolpix P7000 a while ago. One reason for choosing that model was that it can produce RAW images. Well, only Nikons ViewNX software supports it. No luck with iPhoto, no luck under Linux. So I decided to see what I could do myself and started checking out the source of dcraw. The author was very helpful but couldnt provide a “color matrix” (without the camera, or a particular picture taken with the camera). Now I have calculated a reasonably good color matrix myself.

A few notes:

  1. Determining a color matrix is tricky, and not a completely objective business. Please see this separate post about finding the color matrix, in case you dont trust it or like it.
  2. A little trick was needed for ISO400 and above, please see separate post
  3. The patch is not written for libraw, but with little skills you will be able to apply it to the file interal/dcraw_common.cpp in libraw sources

The effect of the patch is displayed by these pictures:

  • Upper left: no patch applied
  • Upper right: patch with no color matrix
  • Lower left: full patch, with my color matrix
  • Lower right: picture as camera exports it to JPG

Well, some brightness and auto-white-balance (-b 1.4 -a) and we have:

Maybe an even better color matrix can be found, but right now I feel that the ISO400 problem mentioned above is more important.

Now the dcraw patch (for version 9.04):

*** dcraw.c	2010-11-09 17:17:22.162772794 +0100
--- dcraw-new2.c	2010-11-14 18:41:24.802772823 +0100
*** 6367,6372 ****
--- 6367,6374 ----
  	{ 7971,-2314,-913,-8451,15762,2894,-1442,1520,7610 } },
      { "NIKON COOLPIX P6000", 0, 0,
  	{ 9698,-3367,-914,-4706,12584,2368,-837,968,5801 } },
+     { "NIKON COOLPIX P7000", 0, 0,
+ 	{ 7177, -1363, -1257, -1529, 7422, 839, -795, 1563, 2398 } },
      { "OLYMPUS C5050", 0, 0,
  	{ 10508,-3124,-1273,-6079,14294,1901,-1653,2306,6237 } },
      { "OLYMPUS C5060", 0, 0,
*** 7248,7253 ****
--- 7250,7261 ----
    } else if (!strcmp(model,"COOLPIX P6000")) {
      load_flags = 24;
      filters = 0x94949494;
+   } else if (!strcmp(model,"COOLPIX P7000")) {
+     load_flags = 24;
+     filters = 0x94949494;
+     if (iso_speed >= 400) {
+       black = 256;
+     }
    } else if (fsize == 1581060) {
      height = 963;
      width = 1287;

Testing Macro capacity of Nikon P7000

I bought a Nikon P7000 compact camera a little while ago (the Canon 450D belongs to my girlfriend, and sometimes I cant borrow it). I was a little curious how it performs in macro photography. So, again, I photographed my little train. First the full shot:

Nikon P7000@6mm, 5s, f/5.6

Not so bad. The barrel distortion is clearly visible. This picture is taken from about 2cm distance from the object, with the lens at its widest setting. As I zoom in, minimum focus distance quickly increases, and the widest mode gives the largest magnification of the object.

Now the crop of the details (the object is about 6.5 mm wide in real life):

Nikon P7000@6mm, 5s, f/5.6, crop

So, it is very possible to read those little characters on the train. Comparing with the other two Macro tests I have made in the past, I draw the following conclusions:

  1. Nikon P7000 beats Canon 450D with 18-55mm kit lens
  2. If Macro Effect filter is applied to the 18-55mm lens, its a draw
  3. The SLR camera wins when equipped with a Macro Extension Tube

Testing a 25mm Extension Tube

A few weeks ago I tested a Macro Effect filter. The results were not that impressive. I decided to spend some more money on an original Canon EF-25 II Extension Tube (the “II” is critical if you have EF-S lenses).

The Extension Tube is simply a 25 mm long piece of metal pipe, that fits perfectly between your camera and your lens. You can get cheap ones (that doesn’t have electrical connectors) or expensive ones. They have no glass anyway.

Moving the lens away from the camera (sensor) has two effects:

  1. it crops the picture, making objects larger
  2. it changes the shortest possible distance usable for the lens

It is the second effect is the crazy cool one. For my two EF-S lenses, and my fixed 50mm EF lens, this is the effect:

   Lens        Original Range               New Range (roughly)
   18-55 mm     25 cm - infinity             0 cm - 20 cm
   55-250 mm   110 cm - infinity            15 cm - 400 cm
   50 mm        45 cm - infinity            10 cm - 15 cm

So, I can get really close to the object. However, it is now impossible to focus on anything far away. There is of course some math, some science, and some theory about this, but I dont really know much about it.

With the extension tube on, zooming does not really work as expected. Instead, the zoom decides the rough focus distance. So, for the tele lens, at 55 mm I can focus on things roughly 15 cm away. As I zoom in towards 250 mm, the focus distance increases to 4 meters. The size of the object in the lens is somewhat constant, since I move away from the target at the same time as I zoom in more and more. The focus ring can be used to fine-adjust focus, but if the zoom is not fairly correct, you can never get focus. With some luck, auto focus works.

Train revisited
Of course I started photographing the same train as I did with the Macro Effect filter. RAW mode used, picture exported to JPEG with iPhoto.

18-55@44, 2.5 sec (ISO800), ~15 cm from object

As I see it, the picture is much better than what was achieved with the cheap Macro Effect lens. Especially, the picture is sharp not just in the middle. Lets look at a crop:

Crop of text details

As I see it, this crop of the center of the picture is slightly sharper than with the Macro Effect filter.

Finally, something more artistic.

18-55@36, f/9.0, 1.6s, ISO100

Even if this is at 36 mm, I cant get much closer, because the object hits the lens. Not possible to go all the way down to 18 mm.

18-55@53, f/9.0, 5s, ISO100

Would I recommend anyone to pay almost EUR 150 for this thing? Well, it is small, and it turns your 18-55 kit lens into a macro lens. The result is much better than a cheap filter. Perhaps for the 18-55 lens it is better to get the 12 mm extension tube…

For more nice macro photos, try this page.