rapp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Rapp-users] Morphological functions


From: Johan Almbladh
Subject: Re: [Rapp-users] Morphological functions
Date: Sun, 12 Aug 2018 19:13:31 +0200

Hi Douglas,

I think you might have not initialised the padding pixels around the source image properly. All spatial filter functions, convolutional and morphological, assume that the source image is padded with the proper values. The functions reads the padding pixels outside the source image area as it computes the edge pixels in the destination image. It is up to the caller to allocate sufficient padding and initialise those pixels properly. Please also note that binary images are stored as 1 bit per pixel and not 8 bits.

For binary morphological operations, the padding is initialised using the functions rapp_pad_const_bin() or rapp_pad_clamp_bin(), depending on what boundary conditions you want. In your case the process would be as follows.

1. Allocate a larger buffer to hold the binary threshold image + the necessary padding.
2. Threshold the source image, letting the function write to the actual image area within the larger buffer allocated above.
3. Initialise the padding pixels properly. The required size of the padding depends on the structuring element size.
4. Perform the desired morphological operation on the binary source image.

The recommended practice is to always use pixel buffers with enough padding outside the real image area in order to avoid copying data for operations where padding is needed.

Unfortunately there are not much sample code snippets available, but the docs are quite extensive and should contain everything you need. Please see the sections on padding, pixel buffer semantics and morphological filters for details.

Best regards,
Johan

On Wed, Aug 8, 2018 at 5:53 PM, Douglas Medeiros <address@hidden> wrote:
Hello,

I'm working on a project that uses morphological function in order to make an object detection. We recently discovered RAPP and how suitable for embedded processing it could be.
I´ve faced some difficulties because of the (hard) documentation (no samples!), but until now I can use the threshold and Gaussian filters, but the dilate and erode functions I was unsuccessful. The binary image buffer is obtained by using rapp_malloc, actually the binary image is the exact output of the threshold function (rapp_thresh_gt_u8), but the resulting image of the dilate function (rapp_morph_dilate_rect_bin) is a kind of messy.

I'm not sure whether the images are misaligned or the source binary images buffers are not being initialized properly. Hope people here could help me on this.

The images are all grayscale, 640x480. Normally our dilate and erode operation use rectangle structural component with both width and height 15 pixels.

Thanks vary much in advance.

Doug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]