imgProcessor.transform package

Submodules

imgProcessor.transform.PerspectiveTransformation module

class imgProcessor.transform.PerspectiveTransformation.PerspectiveTransformation(img)[source]

Bases: object

fit or add an image to the first image of this display using perspective transformations

addDir(image_dir, img_filter=None)[source]

@param image_dir -> ‘directory’ containing all images @param img_filter -> ‘JPG’; None->Take all images

addImg(img, overlap=None, direction='bottom')[source]
filterMatches(matches, ratio=0.75)[source]
findDimensions(image, homography)[source]
fitImg(img_rgb)[source]

fit perspective and size of the input image to the base image

imageDistance(matches)[source]

imgProcessor.transform.StitchImages module

class imgProcessor.transform.StitchImages.StitchImages(img)[source]

Bases: object

addImg(img, side='bottom', overlap=50, overlapDeviation=0, rotation=0, rotationDeviation=0, backgroundColor=None)[source]

@param side: ‘left’, ‘right’, ‘top’, ‘bottom’, default side is ‘bottom’ @param overlap: overlap guess in pixels of both images @param overLapDeviation uncertainty of overlap -> overlap in range(ov-deviation, ov+deviation) @param rotation: max. rotational error between images @param rotationDeviation: same as overLapDeviation, but for rotation @param backgroundColor: if not None, treat this value as transparent within the stitching area

lastParams

imgProcessor.transform.alignImageAlongLine module

imgProcessor.transform.alignImageAlongLine.alignImageAlongLine(img, line, height=15, length=None, fast=False, borderValue=0)[source]

return a sub image aligned along given line

@param img - numpy.2darray input image to get subimage from @param line - list of 2 points [x0,y0,x1,y1]) @param height - height of output array in y @param length - width of output array @param fast - speed up calculation using nearest neighbour interpolation @returns transformed image as numpy.2darray with found line as in the middle

imgProcessor.transform.equalizeImage module

imgProcessor.transform.equalizeImage.equalizeImage(img, save_path=None, name_additive='_eqHist')[source]

Equalize the histogram (contrast) of an image works with RGB/multi-channel images and flat-arrays

@param img - image_path or np.array @param save_path if given output images will be saved there @param name_additive if given this additive will be appended to output images

@return output images if input images are numpy.arrays and no save_path is given @return None elsewise

imgProcessor.transform.imgAverage module

imgProcessor.transform.imgAverage.imgAverage(images, copy=True)[source]

returns an image average

works on many, also unloaded images minimises RAM usage

imgProcessor.transform.linearBlend module

imgProcessor.transform.linearBlend.linearBlend(img1, img2, overlap, backgroundColor=None)[source]

Stitch 2 images vertically together. Smooth the overlap area of both images with a linear fade from img1 to img2

@param img1: numpy.2dArray @param img2: numpy.2dArray of the same shape[1,2] as img1 @param overlap: number of pixels both images overlap @returns: stitched-image