Introduction to MycoCam 4

MycoCam 4 is the fourth generation of Richard Shotbolt's program for capturing and processing pictures from webcams or other video capture devices and allowing measurements to be taken directly from them. MycoCam 4 is completely free!

MycoCam is intended primarily for use in conjunction with a microscope, when an accurate measuring photomicrograph can be achieved at low cost, and large numbers of formerly tedious measurements can be made very quickly. Most webcams (or digital cameras with webcam capability) will work well with a microscope, but some experimentation will be required to devise a suitable mount. Brunel Microscopes Ltd ( sells a range of camera adapters and a x10 photo projection eyepiece. The program works perfectly with the DCM range of microscope cameras sold by Brunel. The EyeCam and other generic 2MP scopecams work well too. The 5MP models, however, tend to use proprietary drivers and will not work.

You can also make measurements and perform image-processing on image files loaded from digital cameras without webcam capability, or indeed from any source; the maximum image size is limited only by the available memory but real-time image processing on large images requires a large percentage of system resources.

Changes from MycoCam 3

·        A long-standing bug causing poor resolution at high and low light levels has been fixed.

·        The Sharpen function now incoporates a small amount of smoothing.

·        A major new feature, the Focus Stack, has been added.

·        It's still completely free!

System Requirements

        Fast multimedia-capable PC. MycoCam is computationally intensive, especially when real-time image-processing is enabled.

        WindowsTM XP or later

        Minimum 800 x 600 display using 24bit or 32bit True Color mode.

        DirectX 8 or later is required. If not installed as part of Windows, it is available for download from Microsoft's web site. Test MycoCam first, and see if it displays correctly.

Running MycoCam 4

Plug in your camera or other capture device then run MycoCam4. The controls are on the left of the window; you can change this if desired by choosing Options, Align Controls Right.

You will notice that there is a series of tabbed pages which you can select:

  • Preview - choose a video device, set up its operating modes and view full-speed live video.
  • Process - process the live pictures from the camera and adjust them prior to image capture.
  • Measure - view the captured image, and measure and annotate objects.
  • Compare - view a comparison image and associated measurements.

Many of MycoCam's options and features are accessible through popup menus activated by a right-click. Experiment with right-clicking the images, measurement grids and other controls to familiarize yourself with what can be done.

The Preview Page

The Preview Page is where you choose a video device, set it up and view the full-speed live video.

The Devices and Modes treeview control shows all the connected video devices; clicking the '+' box shows the different modes available for that device. Click a mode to select it, and a live image will appear.

Set up your camera
Depending on the features supported by the video device, various buttons below the treeview will be enabled. The Camera Settings button, if enabled, allows various manufacturer-determined options to be set up for your camera. These include options such as brightness, white balance, sharpness etc.

The camera mode is automatically saved on exit, and will be recalled the next time MycoCam is started.

If your camera does not have a live video mode, you will not be able to use the functions on the Preview page, but you will still be able to process and make measurements on images that you have previously transferred from the camera from the Process and Measure pages..

Focus the picture
Observe the live image while very carefully adjusting the camera focus for best clarity. In Preview mode, MycoCam will display frames as fast as the video device can deliver them.

The Process Page

The Process page includes many features to enhance your pictures. It can be used both on live video, and on images loaded from file.

Image Size
Enter the size that you want the image to be displayed at. Irrespective of the captured image size, or the size of the image loaded from file, the image will be resampled to the size you specify in the W and H boxes. When a width is entered, the height is automatically set to 0.75 times the width. You can change the height afterwards if you want. The maximum size of the processed image is 1600 x 1200 pixels, and the minimum is 160 x 120. For most purposes a size of 640 x 480 will suffice, and larger sizes will noticeably slow the performance.

Picture Processing
MycoCam can process video images in real time. This is computationally very intensive and on a slower PC may appear sluggish. The following effects are provided:

Picture Orientation
Use the FlipX checkbox to flip the picture left-right, and FlipY to flip it up-down. This is very useful if you want to work from the other side of your microscope.

Click the Despeckle check box to apply a Median Cut filter to remove most of the speckles. This will blur the image slightly.

Click the Sharpen check box to sharpen the image. This can be used in conjunction with Despeckle.

Find Edges
Click the Find Edges check box to show where the sharp edges are in the picture.

Click the Negative check box to show the image as a negative.
This can sometimes appear to improve clarity.

Picture Correction
Two slider controls allow you to correct for aberrations or perspective in your camera. The upper slider adjusts the squareness by a small amount. Use this control to make circles look circular. If you can not find a suitable circular object, use a ruler or calibrated slide. You can check the adjustment by rotating the camera through 90 degrees.

The lower slider compensates for radial distortion in the lenses, and for perspective. Adjust this to make straight lines near the edges of your image look straight.

Color, Brightness and Contrast
These sliders allow you to adjust the color balance of the picture, and to set its overall brightness and contrast. You can achieve a warmer 'tungsten lamp' effect by moving the red and green sliders up together to increase the yellowness; conversely you can increase the blue slider for a 'daylight' color balance.

Reset All
Click the Reset All button to restore all image-processing defaults.

MycoCam uses an advanced technique called flat-fielding to remove the effects of dust on lenses, imperfections in camera electronics, uneven lighting etc. A grossly-defocused picture is taken and processed to result in a uniform user-defined color in the final image.

Click anywhere in the preview image and you will notice that the box to the right of the Color -> button changes to the color of the point that you clicked. For the most effective flat-fielding, click on a point that is most representative of the background color of the preview image. Click the Color -> button. After a short pause the preview image should show a uniform shade of color. The corrections are stored and applied to all subsequent images. You can remove the flat-field correction temporarily by unchecking the Use Flat Field Correction checkbox, or permanently by clicking Cancel.

Grab Image
When you are happy with the picture as displayed in the Preview page, click Grab Image and you will be taken to the Measure page where the captured image awaits your measurements.

As a shortcut, you can grab an image by double-clicking it.

Open an image from file
In addition to grabbing live images, you can also capture and process image files from disk. Right-click the picture and choose Open File. You can then select an image file of virtually any format to load and process. To return to live image processing, right-click and choose Live Video.

Add to Stack
Adds the current image to the designated FocusStack folder as StackXXXX.jpg, with 100% quality. The image number is auto-incremented.

Pressing the space bar while on the Process page also adds the image to the stack.

Clear Stack
Deletes all the images from the designated FocusStack folder.

Focus Stacking

This is a technique for greatly improving depth of field by taking a series of snapshots, moving the focus knob very slightly between frames. MycoCam 4 now allows you to take a series of pictures which are added to the designated FocusStack folder as Stack0001.jpg, Stack0002.jpg etc. at 100% quality. This folder is by default in \MycoCam\Images\FocusStack, but you can change this with the Options, Paths menu.

Snapshots are taken using the Add to Stack button on the Process page, or by pressing the Space Bar when on the Process page. The current stack can be deleted with the Clear Stack button.

Once a set of images is captured, you can either use one of the several free focus-stacking programs to process them, or you can use the very simple built-in functions accessed from the Focus Stack tab. MycoCam extracts from each image the area of greatest change, which represents the part in best focus. No image alignment or other sophisticated algorithms are used, so the built-in option is most suitable for single small features which do not move between frames.

Sample Matrix
MycoCam can either use the changes around a single pixel (1x1) or in a block of 9 pixels (3x3). Use trial and error to see which gives the best result for any given set of frames.

Despeckle Frames
Noise spots, bad camera pixels etc. are removed using a 3x3 median filter prior to processing the frames, with the disadvantage of blurring the image slightly.

Gaussian Smooth
A theoretically ideal smoothing filter to remove artifacts of the frame selection process.

Gaussian Sharpen
A theoretically ideal sharpening filter to remove some of the blurring caused by despeckling and smoothing, although it cannot recover all the fine detail.

Process Stack
Click to begin processing. The processed image will appear at the end.

Transfer to Measure
The processed image is transferred to the Measure page which then appears. All the measurement functions can be performed with the stacked image.

Making Measurements

The Measure Page provides tools for taking accurate measurements from the captured image and analysing the results. Many of the features are accessed from a popup menu launched by right-clicking the picture.

Measuring with MycoCam
Left-click any point within the Measure image. Notice that an annotation in the form of a number in a white box appears immediately to the left of the pointer. Repeat, this time holding the left mouse button down while dragging the mouse. A circle will appear. One point of the circle (the first point you clicked) remains fixed while the other follows the mouse pointer. When you are taking measurements for real, these two points represent the extents (length, width or depth) of the object you are measuring.

Release the left mouse button. Notice that the circle size now remains fixed, while the center of the circle moves with the mouse pointer. You can now change the size of the circle with the cursor keys, or alternatively with the mouse wheel if you have a wheelmouse.

Change the measuring circle color
Right-click the picture and select Toggle Measuring Circle Color [C]. The circle outline will toggle between black and white.

Calibrate the measuring circle
Before taking measurements, it is necessary to calibrate the measuring circle. Go back to the Preview page and use Capture Image to take a good picture of a measuring slide, ruler or other object of known size. Left-click the object on the Measure page and drag the circle until it represents the dimension you want to use for calibration. Now right-click and choose Set Circle Size [S] from the popup menu. Enter the actual dimensions of the object when prompted then click OK. The circle can now be used for accurate measurements. Experiment with clicking, dragging and resizing the circle until you are familiar with the measurement process.

Save calibration to a lens file
To avoid having to repeatedly set the circle size, you can save the calibration to disk. In the main menu, choose Calibrate, Save Lens File. Enter a brief description of the lens then click OK. You will then be prompted for a filename, with the description as the default. Click OK to accept, and the measuring circle scaling and picture size will be saved.

Load calibration from a lens file
To use the predetermined calibration settings for a particular lens, choose Calibrate, Load Lens File from the main menu. Select the correct calibration file then click OK to accept. The measuring circle scale and picture size will be loaded.

Accurately measure objects
Go to the Process page and take a good picture. On the Measure page, right-click the picture and choose New Measurement [N] from the popup menu. Select an object and use the left-click and drag to measure the longest dimension of the object. Use the mouse wheel or cursor keys to adjust the circle size if necessary.

To log the length in the measurement table on the right of the page, right-click the picture and select Update Length [L]. Now measure the shortest dimension of the object and log it by selecting Update Width [W]. If the nature of the objects allows you to determine the depth as well, select Update Depth [D].

Note: If the width is greater than the length, the two measurements will be automatically transposed by default. You can turn off this feature by unchecking the menu item Options, Auto Swap if W > L. Spore length is taken as the dimension through the apiculus, and some spores may be broader than long.

To measure another object, right-click the picture and choose New Measurement [N].
To delete the current measurement, right-click the grid and choose Delete Measurement [Del]. You can also delete a specified measurement from the table by selecting it first before right-clicking the grid and selecting Delete Measurement.
To clear all measurements, right-click the grid and choose Delete All Measurements [Ctrl-Del]..
To undo the last change to the measurement table, right-click the grid and select Undo Measurement Change [U].

If the menu item Options, Auto New After Width is checked, MycoCam will automatically start a new measurement after the width has been entered.

Measure objects larger than the circle will allow, or replace a previous measurement with a new one
Measure part of the dimension in question, log the measurement and note where the circle finishes. Start a new circle and extend the measurement. Now log the measurement again without choosing New Measurement. MycoCam will give you three options:

  • Click Yes to add the new measurement to the previous one.
  • Click No to replace the old measurement with the new one.
  • Click Cancel to ignore the new measurement (useful if you intended to start a new set of measurements but forgot to select New Measurement!)

Automatically grab images for measurement
By selecting the menu item Options, Auto Grab Processed Image, you can make measurements on an image which is automatically updated once per second. In this mode, you can not add annotations to the image.

Keyboard shortcuts

The letter after each popup menu item represents the shortcut key you can press as an alternative to right-clicking: It is worth memorising these as they speed up data entry considerably:

  • N - New measurement
  • L - Update length
  • W - Update width
  • D - Update depth
  • Del - Delete measurement
  • Ctrl-Del - Delete all measurements
  • U - Undo measurement change

Length/width ratio (Q)
The fourth column in the measurement table represents the ratio of length to width, often called Q. This ratio is very well defined for certain organisms e.g. fungus spores, and can prove a useful aid to identification in conjunction with the length and width.

Review measurement statistics
The table below the measurements shows the minimum, average and maximum values for length, width, depth and Q for the current set of measurements.

Annotate the picture
Right-click the picture and select Freeze Annotation [F]. The measurement circle and its associated annotation will become part of the picture. Choose Toggle Annotation Mode [M] to switch the annotation between the circle size and a comment typed into the Notes box above the picture. To undo an annotation, choose Undo Last Annotation [Ctrl-Z]. To remove all annotations and other picture changes, choose Undo All Picture Changes [Ctrl-A].

Zoom in on the picture
MycoCam provides the means to zoom in closer on areas of interest. Use the click and drag method to produce a measurement circle centred on the area of interest. Before you release the left mouse button, press and hold the Ctrl key. Release the left mouse button and the area encompassed by the circle will expand to fill the picture. The circle scale will change accordingly so that accurate measurements can be made on the enlarged area. To restore the picture to its original size, right-click and select Undo All Picture Changes [Ctrl-A]. All annotation will be lost as well.

Save pictures, measurements and settings
Click Save File. You will then be prompted for a title. Enter something relevant and click OK. A dialog box will prompt you for the name of the .cam file. Enter a filename and click OK, and the picture and all the program settings and measurements will be saved.

For example, if you save a picture as, a file called containing all the settings is created, plus a JPEG image file of the actual picture called spores.jpg. You can view and edit the JPEG file using image-editing programs, but you should not resize it or MycoCam will not display it properly.

As an alternative to the button, you can right-click the picture and select Save File.

Load pictures, measurements and settings
Click Open File and choose the .cam file that you want to review. The picture will be loaded and the program will adopt all the settings (measuring circle scale etc.) which were saved with the picture. The associated measurements will be shown in the grid.

You can also load .jpg image files. If a .cam file does not already exist for the image, it will be created. If a .cam file already exists you will be asked whether to delete it; you should choose yes if you want to use the current measuring circle settings etc.

As an alternative to the button, you can right-click the picture and select Open File.

Grab an image from the Measure page and save to file
Right-click the picture and select Save Image File [J]. The picture with any annotations added will be saved to the chosen image file format. You can choose either JPG, GIF, PNG or BMP file formats.

Return to the Process page
Either select the Process tab, or double-click the measure image to return to the Process page.

Making Comparisons

The Compare page allows you to compare the image you are measuring with a second, stored image.

Load pictures, measurements and settings for comparison
Click Open File and choose the .cam file that you want to use for comparison. The picture will be loaded into the Compare page but the measurement settings are unaffected. The associated measurements will be shown in the Comparison table.

You can also load .jpg image files. If a .cam file does not already exist for the image, it will be created. If a .cam file already exists you will be asked whether to delete it; you should choose yes if you want to use the current measuring circle settings etc.

As an alternative to the button, you can right-click the picture and select Open File.

Percentage match
The box to the right of the Open File button shows the percentage match between the data in the Measurements grid and those in the Comparison grid.

Using Image Galleries
These are a new feature in MycoCam 3.

Image galleries are folders (typically subfolders off the MycoCam/Images folder) where a series of JPEG images can be stored sequentially, and viewed as thumbnails or full-size. Image files are stored in the form Image1234 (Title).jpg. The image numbers are maintained in strict sequence automatically as images are added to or deleted from the gallery. The images have a caption in brackets which stays constant as the filename changes.

A series of thumbnail images down the left side of the tab shows the images that are currently in the gallery. Clicking a thumbnail will display it full-size

Adding pictures to the gallery
By default, MycoCam captures and processes live video from the camera until one of the thumbnails is clicked. Press the Space Bar to capture an image and add it to the gallery. Pictures can be added manually to the gallery and will be automatically converted to the correct file name structure. Note that the gallery only handles JPEG files.

Deleting pictures from the gallery
To delete an individual image, click its thumbnail then right-click and choose Delete Image from the pop-up menu. To delete ALL images in the gallery, choose Delete ALL Images from the pop-up menu.

Adding captions to filenames
Each filename has an optional caption in brackets. To edit the caption, click the thumbnail, right-click then choose Change Caption from the pop-up menu; alternatively, double-click the thumbnail.

Changing the gallery folder
The gallery folder is by default \My Documents\MycoCam\Images\Gallery. To change it, choose Options, Paths, Gallery Path from the main menu. You can choose an existing folder, or create a new gallery.

Return to live video mode
Right-click anywhere and choose Live Video, or click the Live Video button.

Copying to the Clipboard

You can copy the MycoCam form or any of the displayed images to the Windows Clipboard for pasting into other applications. When copying, ensure that no other windows are overlapping the one you want to copy, unless you want this included in the copy!

Copying the form
Select Copy Form from the main menu. An image of the whole form excluding title bar will be copied to the clipboard.

Copying pictures
Right-click a picture and select Copy Image. Depending on which page you are viewing, a copy of the Process, Measure or Compare pictures will be placed on the clipboard.


MycoCam will print the complete form with whatever page is currently visible. When printing, ensure that no other windows are overlapping the one you want to copy.

Setting printer properties
Select Print Setup from the main menu. The standard Windows print setup dialog will appear. Choose the Landscape option for your printer if the paper size is less than 9” (25cm) wide.

Printing the form
Select Print Form from the main menu. An image of the whole form including picture and measurements but excluding the title bar will be sent to the printer.

Contacting the Author

Please send requests for advice, bug reports, suggestions for improvement etc. to the author at the following URL: