Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

radofaletic/transforms

Repository files navigation

README

version 1.0

These programs produce transforms from any input image.

What does this program do?

Very simply, these programs produce transforms of any input image. Currently implemented transforms are Fourier, Hough, Radon and Backprojection.

However, there are several enhancements and caveats to be aware of:

  1. These programs are capable of using (and producing) multi-colour images (greyscale, RGB and CMYK). Each colour channel is treated separately, and then recombined at the end.
  2. However, note that in order to achieve acceptable results, any transparency is flattened prior to running the code, using alpha blending.
  3. For Radon projections, each projection angle is achieved by rotating the original image. This, necessarily, introduces some interpolation artifacts. Sorry, no way around this without reverting to more complex (and expensive) algorithms — this one is already O(N³). We use the OpenCV algorithms which have proved far superior to GraphicsMagick in this regard (faster, and better quality).
  4. Whilst the code does its best to utilise threading, it may still perform rather slow (especially for images in the megapixel range), especially on older computer with limited compute cores.

Typical run-time options

--input=<inputfile>
--output=<outputfile>
--normalise=<on|off>
--harmonisedScaling=<on|off>
--gpu=<cuda|opencl|cpu|off>

How to build the programs

There’s a Makefile in the directory. Check the relevant CXXFLAGS, CPPFLAGS and LDLIBS definitions, and then simply run “make”.

Requirements

The GraphicsMagick (http://www.graphicsmagick.org/) library is required (for the Magick++ development tools), which itself depends on many other libraries (libpng, libjpeg, libtiff, giflib, libxml, etc.). Note that many pre-compiled versions of GraphicsMagick will be sub-optimal or unsuitable. You will most likely need to build a custom version of the library, in particular the library build should be configured with the --with-quantum-depth=16 option.

The OpenCV (http://www.opencv.org/) computer vision library (plus its contrib packages) is required, which itself may depend on numerous other libraries (libpng, libjpeg, libtiff, etc.) depending on the build platform. To build on macOS, follow the same instructions as for iOS (https://docs.opencv.org/4.0.0/d5/da3/tutorial_ios_install.html) but with the last line replaced by “python opencv/platforms/osx/build_framework.py macos”. In any case, the shell scripts described below have been developed to set some default build options that are known to work.

The file aws-ec2.sh has a full shell script to prepare and build all relevant libraries on AWS Linux. There is also a macos.sh script to assist with relevant libraries for macOS.

Further information

Contact the author, Rado Faletič radofaletic@gmail.com

About

Code to generate a sinogram of any arbitrary image file.

Topics

Resources

Stars

Watchers

Forks