im_cntlines, im_profile - calculate transitions between black and white
pels horizontally or vertically
int im_profile(in, out, dir)
IMAGE *in, *out;
int im_cntlines(in, nolines, dir)
im_profile(3) searches inward from the edge of the image and finds the
first non-zero pixel. It outputs an image containing a list of the
offsets for each row or column.
If dir ==0, then im_profile(3) searches down from the top edge, writing
an image as wide as the input image, but only 1 pixel high, containing
the number of pixels down to the first non-zero pixel for each column
of input pixels.
If dir ==1, then im_profile(3) searches across from the left edge,
writing an image as high as the input image, but only 1 pixel wide,
containing the number of pixels across to the first non-zero pixel for
each row of input pixels.
im_cntlines(3) calculates the number of transitions between black and
white pixels of an image. If dir is 1 then all transitions across the
vertical direction are calculated for all Xsize lines of the image. If
dir is 0 then all transitions along the horizontal direction for all
Ysize lines are calculated. The function returns the number of
transitions divided by twice the number of the corresponding Xsize of
Ysize lines. The program is primarily used to calculate the number of
unbroken horizontal (dir=0) or vertical lines (dir=1) that exist within
an image. Input image in can have only one channel.
All functions returns 0 on success and -1 on error.
14 May 1991 LINES(3)