Community
cancel
Showing results for
Did you mean:
Beginner
79 Views

## Problem with ippiDilate_16u_C1IR

#include

#include "ippdefs.h"

#include "ippi.h"

// Create a disk (circular) structuring element

{

size_t nKernel = 2 * radius + 1;

std::vector disk(nKernel * nKernel, 0);

for (size_t iRow = 0; iRow < nKernel; ++iRow)

{

int dR = (int)radius - (int)iRow;

for (size_t iCol = 0; iCol < nKernel; ++iCol)

{

int dC = (int)radius - (int)iCol;

if (dR * dR + dC * dC <= rSquared)

disk[iRow * nKernel + iCol] = 1;

}

}

return disk;

}

// Verify that the dilation of a single point centered in an image

// of the appropriate size matches the mask.

{

// Construct a circular mask of the specified size.

// Create an Ipp image to perform the dilation in.

int stepBytes = 0;

size_t stepElements = (size_t)stepBytes / sizeof(Ipp16u);

// Set the ROI to the entire image and then set the image to 0.

Ipp16u* roiStart = data;

ippiSet_16u_C1R(0, roiStart, stepBytes, roiSize);

// Set the roi to a centered square of the same size as the mask.

// Set the center pixel of the image to 1.

// Dilate the image using the mask.

// Check that each pixel in the roi matches the mask.

bool good = true;

for (size_t iRow = 0; iRow < maskSize; ++iRow)

{

for (size_t iCol = 0; iCol < maskSize; ++iCol)

{

if (mask[iRow * maskSize + iCol] != roiStart[iRow * stepElements + iCol])

{

good = false;

}

}

}

// Cleanup

if (data != 0)

{

ippiFree(data);

data = 0;

roiStart = 0;

}

return good;

}

3 Replies
Employee
79 Views
Hello,
could you please specify what IPP version and what platform do you use?
Regards,

Beginner
79 Views
Quoting - vdudnik
Hello,
could you please specify what IPP version and what platform do you use?
Regards,