CamCopyM4 for Mach4

CamCopyM4 is the Mach4 edition of UCamCopy, a vision based probing and ‘line following’ program. It provides 2D perimeter tracing with a camera instead of a touch probe. It requires a webcam, preferably a ‘microscope’ based camera with fairly high magnification. Preferred image resolution from the camera is 640×480 at 30 fps, making cheap cameras ideal. The camera image is processed with EMGU/OpenCV to find edges, lines, circles and shapes. Once an edge is found, CamCopyM4 drives the machine along it through Mach4 and records the path to DXF and CSV files for reconstructing or copying geometry. It runs as a separate program next to Mach4 and talks to Mach4 through its own IPC library, so no Mach4 plugin or screen-set change is needed.

Current version: v2.403 (Mach4 4.2.x; checked with 4.2.0.4612 and 4.2.0.5036).

Features:

  • Camera based edge/line detection and automatic edge following, recording the traced path to DXF (and CSV)
  • Video probe circles and arcs: 3 point and multiple point with least squares fit to find centers/diameters
  • Locate line ‘intersections’ as a target point; set G68 rotations
  • Improved line detection by merging similar lines into a ‘best fit’
  • Manual point recording and creating lines/perimeters in the DXF, as well as auto tracing
  • Multiple views to help adjust the image (original blurred image, canny detections, threshold and composite images shown simultaneously), plus one-click Auto Tune
  • 3D/DXF viewer and editor shared with ProbeIt and UCamCopy, with layer and color control, measuring and editing tools; DXF files optimized for VCarve and Lightburn
  • Jogging and ‘move to’ controls built in, plus help / setup guides
  • Per-axis velocity jogging through Mach4
  • Motion is on by default, with a read-only shortcut for set-up and viewing
  • E-Stop button that disables and, after you confirm, re-enables the control
  • The program tells you which Mach4 and which Mach4IPC.dll it is using
New in v2.403 (click to expand)
  • Lock onto one target. With the Circles or Contours detector, click a circle or contour in the image to follow only that one. Right-click the image or press Unlock Target to release it; if the target is lost, its last position is held for about half a second. There is a new Locked Target Color setting.
  • Circle detector settings. New Circle Edge (Canny), Circle Min Radius and Circle Max Radius settings, a floor of 8 on the Circle Threshold and a limited radius search cut the CPU load and let small circles be found.
  • Contours. The contour detector outlines all shapes above the new Contour Min Area size so one can be picked.
  • Process at. A new drop-down runs the detectors on a smaller picture, a large CPU saving with 720p / 1080p cameras.
  • Gear buttons on the main window open the Image Detection and Offset & Velocity windows.
  • Mach4 connection. CamCopyM4 now connects through the name localhost, which fixes error -17 (“Mach4IPC.dll does not match the running Mach4”) on PCs where the numeric address 127.0.0.1 was refused.

Using UCCNC or Mach3? See UCamCopy for UCCNC and CamCopyM3 for Mach3. Or compare all three versions.

See it in action:

CamCopyM4 running next to Mach4, connected through Mach4IPC.dll
CamCopyM4 runs as its own program next to Mach4 and tells you which Mach4 it is connected to.

Edge tracing in action:

CamCopyM4 following an edge with Mach4 and recording the path to DXF.
CamCopyM4 with its 3D viewer showing a traced edge recorded to DXF
The traced path is recorded live in the 3D/DXF viewer.

More UCamCopy videos at this playlist show the same windows.

Download here:

CamCopyM4 User Manual (online)

To install: run the installer (administrator rights needed). Nothing is installed into Mach4. Start Mach4, wait until it has loaded, enable the machine, then start CamCopyM4 from the Start Menu. If it reports a library mismatch or error -17, use the /mach4dir switch described in the manual.

Purchase here:

CamCopyM4 is $30 for a license key. It is a fully functional demo that is free to use for 20 days to verify its functionality and to see if it works for your needs. The license is tied to this PC (the computer ID Mach4 reports). If that ID changes, a new key is needed. Additional keys for more computers are available on request. See How to Buy for how to find your License ID.

Buy Now — $30 USD

All license sales are final. Because license codes are delivered instantly as digital goods, they are non-refundable, so please try the free demo first to make sure it suits your setup.

Requirements

* Mach4 4.2.x, Windows 7 or later, and .NET Framework 4.0 or later. CamCopyM4 uses the Mach4IPC.dll of the running Mach4 (installed with Mach4). If the program reports error -17, point it at the right Mach4 folder with /mach4dir= (see the manual). It has been tested with Mach4 running a CNCDrive controller. Other controllers may work adequately, or may not. Testing them is up to you, at your own risk: please test functionality on your setup before purchase.

* You need to have a camera, preferably a ‘microscope’ camera with the ability to focus up very close and create a zoomed in image. The camera needs to be able to provide an image of 640×480, and 30 fps. It is not recommended to seek a camera with more resolution, as the frame-rate drops significantly with large images due to the amount of processing required to detect lines/edges/contours. See the camera recommendations on the UCamCopy page.

* A little patience 🙂 CamCopyM4 requires a fair bit of user input and setup, with adjusting image lighting, focus, and detector parameters. Please contact me to let me know of issues found, or to propose enhancements.

Versions

Version History (click to expand)

V2.403: 11/22/2026

Circle detector: new Circle Edge (Canny), Circle Min Radius and Circle Max Radius settings, a floor of 8 on the Circle Threshold and a limited radius search, which cut the CPU load and let small circles be found. Lock onto one target: with the Circles or Contours detector, click a circle or contour in the image to follow only that one; right-click the image or press Unlock Target to release it (its last position is held for about half a second if it is lost). The contour detector outlines all shapes above the new Contour Min Area size so one can be picked, and there is a new Locked Target Color setting. Camera: a new “Process at” drop-down runs the detectors on a smaller picture, a large CPU saving with 720p / 1080p cameras. Gear buttons on the main window open the Image Detection and Offset & Velocity windows. Mach4 connection: CamCopyM4 now connects through the name localhost, which fixes error -17 (“Mach4IPC.dll does not match the running Mach4”) on PCs where the numeric address 127.0.0.1 was refused.

V2.402: 11/7/2026

Viewer: Measure menu (distance, 3-point radius, 3-point angle, circle / arc, length / area, point coordinates, path length, gap / width between edges, selection extents) with a live readout panel and a measurement window; Edit menu (draw line, break at point, remove section, join polylines, fit smooth polyline); File menu; Zoom box and Select icons; tool cursors; Draw line snaps to more points. New Units setting (inch / millimeter). Fixed: a DXF saved while a layer was hidden could not be opened again. Example DXF drawings are installed in the output\Samples folder. Same version number as UCamCopy for UCCNC and CamCopyM3. See the online manual, sections 16.10 and 16.11.

V2.400: 10/18/2026

First release of the Mach4 edition of UCamCopy, built on the same code as UCamCopy for UCCNC: main window, image detection and Auto Tune, PID velocity control, DXF and CSV recording, 3D viewer and DXF editor. Talks to Mach4 through Mach4IPC.dll with no Mach4 plugin; Windows installer; HTML manual.