Hi,
I am using the IMG_dilate_bin filter from "imglib_c66x_3_1_0_1" for C6678 device with CCS v5.2. However, i cannot obtain the correct output.
I wrote a little test in C++ to communicate the issue:
#include <stdio.h>
extern "C" {
#include <IMG_dilate_bin.h>
}
int main (void)
{
unsigned int dilate_height = 8;
unsigned int dilate_width = 8;
unsigned char dilate_input[64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x05, 0x50, 0x00, 0x00, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 0x55, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
char dilate_mask[9] = { -1, 1, -1,
1, 1, 1,
-1, 1, -1 };
unsigned char dilate_output[64] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
// apply the TI dilate filter
IMG_dilate_bin(dilate_input, dilate_output, dilate_mask, dilate_width);
// Printing the output
int i, j;
printf("\n\n{\n");
for (i = 0; i < dilate_height; ++i)
{
for (j = 0; j < dilate_width; ++j)
{
printf("%d, \t", dilate_output[i*dilate_width + j]);
}
printf("\n");
}
printf("\n}\n\n");
return 0;
}
The code above generated the following output:
[C66xx_0] {
[C66xx_0] 192, 7, 124, 0, 0, 7, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0] 0, 0, 0, 0, 0, 0, 0, 0,
[C66xx_0]
[C66xx_0] }
Hence, only the first row is processed.
Then I decided to look inside the IMG_dilate_bin.c file. I decided to replace the MUST_ITERATE and UNROLL pragmas with a for loop and also pass in the "rows" (in addition to the "cols"), and the filter seems to process on all the lines. However, the resulting output is not 100% correct excluding the borders.
Could you please help me as to how to use the filter properly?