Safe Haskell | None |
---|
Mathematical and statistical operations for images. See also module CV.ImageMathOp which contains handy operators for some of these.
- add :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- sub :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- absDiff :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- mul :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- div :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- min :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- max :: Image c1 d1 -> Image c1 d1 -> Image c1 d1
- maskedMerge :: Image GrayScale D8 -> Image GrayScale D32 -> Image GrayScale D32 -> Image GrayScale D32
- averageImages :: [Image GrayScale D32] -> Image GrayScale D32
- atan2 :: Image GrayScale D32 -> Image GrayScale D32 -> Image GrayScale D32
- subMean :: Image GrayScale D32 -> Image GrayScale D32
- subMeanAbs :: Image GrayScale D32 -> Image GrayScale D32
- sqrt :: Image GrayScale D32 -> Image GrayScale D32
- log :: Image GrayScale D32 -> Image GrayScale D32
- abs :: Image c d -> Image c d
- atan :: Image GrayScale D32 -> Image GrayScale D32
- invert :: Image GrayScale D32 -> Image GrayScale D32
- addS :: D32 -> Image GrayScale D32 -> Image GrayScale D32
- subS :: Real a => Image c d -> a -> Image c d
- subRS :: D32 -> Image GrayScale D32 -> Image GrayScale D32
- mulS :: D32 -> Image GrayScale D32 -> Image GrayScale D32
- minS :: Float -> Image c d -> Image c d
- maxS :: Float -> Image c d -> Image c d
- lessThan :: D32 -> Image GrayScale D32 -> Image GrayScale D8
- moreThan :: D32 -> Image GrayScale D32 -> Image GrayScale D8
- less2Than :: CreateImage (Image GrayScale d) => Image GrayScale d -> Image GrayScale d -> Image GrayScale D8
- more2Than :: CreateImage (Image GrayScale d) => Image GrayScale d -> Image GrayScale d -> Image GrayScale D8
- sum :: Image GrayScale D32 -> D32
- average :: Image GrayScale D32 -> D32
- averageMask :: Image GrayScale D32 -> Image GrayScale D8 -> D32
- stdDeviation :: Image GrayScale D32 -> D32
- stdDeviationMask :: Image c d -> Image c1 d1 -> CDouble
- findMinMax :: Image t t1 -> (D32, D32)
- findMinMaxLoc :: (Fractional t3, Fractional t, Num t1, Num t2, Num t4, Num t5) => Image c d -> (((t1, t2), t), ((t4, t5), t3))
- findMinMaxMask :: BareImage -> BareImage -> (D32, D32)
- imageMinMax :: Fractional d => Image GrayScale d -> (d, d)
- minValue :: Image GrayScale D32 -> D32
- maxValue :: Image GrayScale D32 -> D32
- imageAvgSdv :: Fractional d => Image GrayScale d -> (d, d)
- gaussianImage :: (Int, Int) -> (Double, Double) -> Image GrayScale D32
- fadedEdgeImage :: (CInt, CInt) -> CInt -> Image channels depth
- fadeToCenter :: (CInt, CInt) -> Image channels depth
- maximalCoveringCircle :: (Fractional t2, Num t, Num t1) => Image c d -> (CInt, CInt, CDouble) -> (t, t1, t2)
- limitToOp :: Image c1 d1 -> ImageOperation c d
Operations for two images
sub :: Image c1 d1 -> Image c1 d1 -> Image c1 d1Source
Calculates the per-pixel difference of two images.
absDiff :: Image c1 d1 -> Image c1 d1 -> Image c1 d1Source
Calculates the per-pixel absolute difference of two images.
mul :: Image c1 d1 -> Image c1 d1 -> Image c1 d1Source
Calculates the per-pixel product of two images.
div :: Image c1 d1 -> Image c1 d1 -> Image c1 d1Source
Calculates the per-pixel division of two images.
min :: Image c1 d1 -> Image c1 d1 -> Image c1 d1Source
Calculates the per-pixel minimum of two images.
max :: Image c1 d1 -> Image c1 d1 -> Image c1 d1Source
Calculates the per-pixel maximum of two images.
maskedMerge :: Image GrayScale D8 -> Image GrayScale D32 -> Image GrayScale D32 -> Image GrayScale D32Source
Merge two images according to a mask. Result is R = A*m + B*(m-1)
.
averageImages :: [Image GrayScale D32] -> Image GrayScale D32Source
Calculates the average of multiple images by adding the pixel values and dividing the resulting values by number of images.
atan2 :: Image GrayScale D32 -> Image GrayScale D32 -> Image GrayScale D32Source
Calculates the atan2 of pixel values in two images.
Operations for one image
subMean :: Image GrayScale D32 -> Image GrayScale D32Source
Calculates the (non-absolute) difference of every pixel to image mean.
See also subMeanAbs
.
subMeanAbs :: Image GrayScale D32 -> Image GrayScale D32Source
Calculates the absolute difference of every pixel to image mean.
See also subMean
.
log :: Image GrayScale D32 -> Image GrayScale D32Source
Calculates the natural logarithm of every pixel.
invert :: Image GrayScale D32 -> Image GrayScale D32Source
Logical inversion of image (ie. invert, but stay on [0..1] range;
multiply by -1
and add 1
).
Operations for a scalar and an image
subS :: Real a => Image c d -> a -> Image c dSource
Subtracts a scalar from every pixel, scalar on left.
subRS :: D32 -> Image GrayScale D32 -> Image GrayScale D32Source
Subtracts a scalar from every pixel, scalar on right.
minS :: Float -> Image c d -> Image c dSource
Calculates the per-pixel minimum between an image and a scalar.
maxS :: Float -> Image c d -> Image c dSource
Calculates the per-pixel maximum between an image and a scalar.
Comparison operations
lessThan :: D32 -> Image GrayScale D32 -> Image GrayScale D8Source
Compares each pixel to a scalar, and produces a binary image where the
pixel value is less than the scalar. For example, (lessThan s I)
has
white pixels where value of I is less than s. Notice that the order of
operands is opposite to the intuitive interpretation of s `
.
lessThan
` I
moreThan :: D32 -> Image GrayScale D32 -> Image GrayScale D8Source
Compares each pixel to a scalar, and produces a binary image where the
pixel value is greater than the scalar. For example, (moreThan s I)
has
white pixels where value of I is greater than s. Notice that the order of
operands is opposite to the intuitive interpretation of s `
.
moreThan
` I
less2Than :: CreateImage (Image GrayScale d) => Image GrayScale d -> Image GrayScale d -> Image GrayScale D8Source
Compares two images and produces a binary image that has white pixels in
those positions where the comparison is true. For example,
(less2Than A B)
has white pixels where value of A is less than value of
B. Notice that these functions follow the intuitive order of operands,
unlike lessThan
and moreThan
.
more2Than :: CreateImage (Image GrayScale d) => Image GrayScale d -> Image GrayScale d -> Image GrayScale D8Source
Compares two images and produces a binary image that has white pixels in
those positions where the comparison is true. For example,
(less2Than A B)
has white pixels where value of A is less than value of
B. Notice that these functions follow the intuitive order of operands,
unlike lessThan
and moreThan
.
Image statistics
sum :: Image GrayScale D32 -> D32Source
Calculates the sum of pixel values in whole image (notice that OpenCV automatically casts the result to double).
averageMask :: Image GrayScale D32 -> Image GrayScale D8 -> D32Source
Calculates the average value for pixels that have non-zero mask value.
stdDeviation :: Image GrayScale D32 -> D32Source
Calculates the standard deviation of pixel values in whole image.
stdDeviationMask :: Image c d -> Image c1 d1 -> CDoubleSource
Calculates the standard deviation of values for pixels that have non-zero mask value.
findMinMax :: Image t t1 -> (D32, D32)Source
Finds the minimum and maximum pixel value in the image.
findMinMaxLoc :: (Fractional t3, Fractional t, Num t1, Num t2, Num t4, Num t5) => Image c d -> (((t1, t2), t), ((t4, t5), t3))Source
Finds the minimum and maximum pixel value in the image and the locations where these values were found.
findMinMaxMask :: BareImage -> BareImage -> (D32, D32)Source
Finds the minimum and maximum value for pixels with non-zero mask value.
imageMinMax :: Fractional d => Image GrayScale d -> (d, d)Source
Finds the minimum and maximum pixel value in the image.
minValue :: Image GrayScale D32 -> D32Source
Utility functions for getting the maximum or minimum pixel value of the
image; equal to snd . findMinMax
and fst . findMinMax
.
maxValue :: Image GrayScale D32 -> D32Source
Utility functions for getting the maximum or minimum pixel value of the
image; equal to snd . findMinMax
and fst . findMinMax
.
imageAvgSdv :: Fractional d => Image GrayScale d -> (d, d)Source
Calculates the average and standard deviation of pixel values in the image in one operation.
Misc (to be moved?)
gaussianImage :: (Int, Int) -> (Double, Double) -> Image GrayScale D32Source
Render image of 2D gaussian curve with standard deviation of (stdX,stdY) to image size (w,h) The origin/center of curve is in center of the image.
fadedEdgeImage :: (CInt, CInt) -> CInt -> Image channels depthSource
Produce white image with edgeW
amount of edges fading to black.
fadeToCenter :: (CInt, CInt) -> Image channels depthSource
Produce image where pixel is coloured according to distance from the edge.
maximalCoveringCircle :: (Fractional t2, Num t, Num t1) => Image c d -> (CInt, CInt, CDouble) -> (t, t1, t2)Source
Given a distance map and a circle, return the biggest circle with radius less than given in the distance map that fully covers the previous one.
limitToOp :: Image c1 d1 -> ImageOperation c dSource
Operation to limit image with another image; same as min
.