LibCapy - Download

LibCapy is a C library I develop as a pet-project. Learn more about it here.

How to download and install LibCapy:

Download the latest version of the library with the following commands:

To download an older version of the library, replace libcapy.latest.tar.gz with the version's tar file (cf below).

Install the library by following instructions in INSTALL.md. The installation process and unit tests have been tested in the following environment (using Docker images or real machine): Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, Manjaro. If you encounter problems and need help, contact me. After installation the folder ~/LibCapy is not needed any more and you can delete it cd ~ && rm -r LibCapy. For examples of how you can use it and what you can do with it, refer to the LibCapy examples.

v0.4.0 (release preview at the end of 2022/11)

tar file: libcapy.0.3.0.tar.gz

- CapyMath. Fibonacci sequence, grid lattice, polar lattice; Fast inverse square root; 3D rotation matrix; Conversion degree/radians. Solver for quadratic, cubic and quartic polynomial.
- Quaternion. Object to perform rotation in 3D using quaternions.
- DiffEvo. Refactor to be multithreaded instead of multiprocessed.

v0.3.0 (released 2022/07/25)

tar file: libcapy.0.3.0.tar.gz

- Comparator. Object to compare data (for example to sort them).
- Generic arrays. QSort.
- Sorting algorithms. QuickSort.
- CapyDistributionContinuous. Generic class to implement probability distribution for continuous random variables.
- CapyNormalDistribution.
- CapyImgKernel. Kernels for image processing. GaussianBlur; DerivativeGaussianBlur.
- CapyImg. Conversion to greyscale, black/white, hsv, normalised rgb, l1l2l3, c1c2c3, L*a*b*, conversion from L*a*b*; Add slope direction in edge map detection, and input channel used for detection; Cleanup function to ensure pixel values are in [0,1]; Set all three channels to the value of one of them in each pixel; Get the neighbour of a pixel; Get an edge map made of the combination of the edge map on each channel, choosing the maximum slope amongs them for each pixel.
- CapyColorPatch.Set of CapyImgPixel. Get the average color; Get the bounding quadrilateral; Get the center of mass.
- CapyColorChart. Add QP203 color chart L*a*b* data; Conversion ColorChart from RGB to L*a*b*; Split brightness in two versions for RGB and L*a*b*; Get similarity value between two charts; Automatically locate a chart in an image; Add X-Rite ColorChecker classic color chart.
- ColorPatch. Index of min/max on arrays of basic types.
- CapyColorSpace. Enumeration to identify color spaces.
- CapyFloodFill.
- CapyTriangle. Get area.
- CapyQuadrilateral. Get area.
- CapyMathFun. Get derivative; Get Jacobian.
- CapyVec. Refactor of CapyVector as a structure. Addition; Substraction; Multiplication; Cross product; Dot produt.
- CapyMat. Matrix data structure. Multiplication (with matrix and vector); Transpose; Inverse and pseudo inverse; Determinant.
- CapyIsAccessibleMem. Check if an adress is in the current accessible address space.
- CapyGraph. Object to manipulate graphs. Add node; Add link; Get connectivity matrix; Get distance matrix (in number of link).
- CapyPowMod. Calculate (a^b)%c using the square and multiply algorithm.
- Chrono. Class to measure elapsed time.
- Automatic code style checking and HTML/PDF doc generation.
- DatasetClass to manipulate datasets saved as CSV file with a descriptive header containing each field, label, type (numerical/categorical) and interface (input/output).
- Bezier. Save/Load to binary stream; Export as ready-to-use C function.
- PointCloud. Class to manipulate point cloud. Load from PLY file (ascii format only); Approximate with a Bezier surface.
- CapyColorCorrBezier. Color correction using Bezier surface; calculation of the Bezier surface matching to color chart; application of the Bezier surface to an image; load/save to a file.
- CapyColorCorr. Parent class color correction classes.
- CapyGreedy. Class implementing the Greedy algorithm.
- I/O Stream. Get file size.
- Math. QR decomposition; Eigen values and vectors.
- FileFormat. Virtual class for all the file format decoder/encoder implementations.
- PngFormat. Class to manipulate file in PNG format. Load/save an image.
- PlyFormat. Class to manipulate file in PLY format. Load/save a point cloud (ascii format).
- KMeans. Class implementing the k-means algorithm. Calculate the clusters best-fitting a point cloud (random, Forgy, plus plus); Get the cluster for a given point.
- DistributionDiscrete. Array of discrete events (pair of id/probability).
- Random. Get a random discrete event.
- FrequentistHypothesisTesting. Class implementing the frequentist hypothesis testing method.

- #9 The conversion of -0.3 to a CapyRatio fails.
- #10 safeMalloc fails if the `size` argument is not a single item (ex: safeMalloc(a, 3 + n))

v0.2.0 (released 2022/03/14)

tar file: libcapy.0.2.0.tar.gz

- Math functions: greatest common divisor using Stein's algorithm; Russian peasant multiplication of positive integers to calculate a*b and a*b/c; smooth step function with controllable slope; power function for integer variables; LERP.
- CapyRandom: pseudo random generator based on 64 bits xorshift, squirrel3 and the Downey's algorithm. Generation of integer, rational and real numbers within an interval.
- CapyElo: function to compute the ELO rank.
- ArgParser: Modif the return type of getAsInt() from int16_t to int64_t
- StreamIO: Add the methods isOpened(), readBytes(), writeBytes()
- Dict: dictionaries with char* key and generic value. Iterators on the dictionaries' entries.
- Ratio: rational number implementation. Addition, negation, substraction, multiplication, inverse, division, absolute value, comparison, reduction, conversion from/to double, raising to an integer power, square root.
- Image. Set the color of a pixel; create a clone; copy an image into anoher; change the gamma encoding; find the brightest pixel.
- Generic arrays. Shuffle.
- loopRange (shortcut of `for` loop on a CapyRange).
- MathFun. Abstract class to be inherited by other objects implementing mathematical functions.
- Bezier. Bezier curve/surface of any order/nb input/nb output.
- Pen. Tool to draw point and CapyBezier on a CapyImg. Color, hardness, size; draw point, line, Bezier.
- Display. Change the window's display during execution; get time in milliseconds since shown; handlers for onShow and onClose events; magnify to fit in an image; interaction via the mouse.
- CapyColorChart. Color chart for image color correction; QP203 color chart data; extraction of a color chart from an image; brightness matching between two charts; load/save to a file.
- CapyColorCorrMat. Color correction matrix; calculation of the matrix matching to color chart; application of the correction matrix to an image; load/save to a file.
- CapyColorHisto. Color histograms. Extract the histograms from an image; apply the histogram to an image.
- CapyDiffEvo. Optimizer using the differential evolution method. Run in a separate process.

- #1 Invalid free at the end of CapyDisplay.show() when the display has been created with CapyDisplayCreate()
- #2 The size of the generic arrays when reallocating is improperly calculated (sizeof(type) missing)
- #3 The size of the allocation in CapyDisplayMagnifierAlloc is erroneous
- #4 Remove the functions CapyVec*Add()
- #5 CapyArr.getPtr return the wrong adress. Multiplication by the size of data is missing
- #6 `loop` doesn't accept `const` variable as `nbIter` argument
- #7 The shared memory segments in CapyDisplay are never deallocated

v0.1.0 (released 2021/11/27)

tar file: libcapy.0.1.0.tar.gz

- Standard functions extended with exception management: safeMalloc, safeRealloc, safeFOpen, safeSPrintf, safeFPrintf, safeFScanf, safeFRead, safeFWrite
- min/max on arrays of basic types
- loop (shortcut of `for` loop) and forEach (iteration using iterators defined by LibCapy)
- println/fprintln (printf/fprintf with a line return)
- $ and $$ (operator for OOP methods)
- CapyInherits macro for class inheritance)
- equal (equality operator on floating point values using the ULP method)
- CapyGetVersion, CapyGetCommitId, CapyGetBuildMode (infos about the library)
- Exception management framework.
- Color, RGB/RGBA/HSV/greyscale modes. Conversion between RGB and HSV.
- Decoration of output to the CLI using escape sequences.
- Generic arrays, fixed size and resizable. Iterators (forward/backward) on these generic arrays.
- Generic double linked lists. Iterators (forward/backward) on these generic lists.
- PNG image, load/save, access/edit pixels. Iterator on the pixels.
- Display in a GTK window of an image in a separate process. Interaction via keyboard. Automatic refresh of the window content when the image is edited.
- Command line arguments parser.
- I/O Stream, load and save a text file content line by line, load and save the content of a file all at once.
- Feistel cipher network, available operation modes are ECB, CBC, CTR.
- Vector, vector of double values for numeric calculation, generic definition for any size, functions: add
- Range, range of numerical value; functions: trim
- CapySleepMs: sleep function accepting millisecond as argument