Hi, I have been confusing with pitch issue, particularly with VLIB for a while. Can anybody suggest some doc or material for me to study? Really appreciated. Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, I have been confusing with pitch issue, particularly with VLIB for a while. Can anybody suggest some doc or material for me to study? Really appreciated. Thanks.
Hi, Paul,
Thanks for the quick response.
Sorry, I am just confused by the Pitch. Here is the example from VLIB:
I have a 720x480 binary image (NTSC) and want to dilate it using VLIB. What's the appropriate way to call?
VLIB_dilate_bin_square((const unsigned char *) img_in, (unsigned char *) img_out + 2880/8, (480*718),720*4); ??????
cols =?, pitch = ?
img_in and img_out are all packed in 32-bit (unsigned int *).
Any input is appreciated. Thanks a lot.
Paul.Yin said:Hi,
What do you mean by "pitch" issue? do you want to know the definition or where it is set?
Please do explain exactly what you want to know, and whether it is generic or VLIB specific.
Hello Michael,
Please refer to VLIB_testDilationErosion.c example in the VLIB package.
I will try to explain how to do the same for your case.
1) First use the Create32BitPackedBinImage function to create a binary packed image.
I am assuming by binary image you meant a 720x480 binary array. After you run the above function, you would get a 720x480/32 array.
2) Dilation is performed by a 3x3 kernel. So the output for the first and last lines cant be determined due to edge effect.
The call would look like this:
VLIB_dilate_bin_square((const unsigned char *) InputPackedData , (unsigned char *) DilatedPackedData + 720/8, (720)*(480-2), 720);
The offset of 720/8 is used to move the output pointer to the second line.
An alternative way of doing the same is
for(i = 1; i <480-1; i++)
{
VLIB_dilate_bin_square((const unsigned
char *) PackedData + 720/8*(i-1) ,
(unsigned char *) DilatedPackedData + 720/8*i,
720, 720);
}
Let me try to clarify the terminology of pitch as I think the confusion is due to this.
You can think of it as an ROI region with a block height and block width inside an image.
To represent the ROI, you would not need the image height. But you would need the image width for pointer increment to the next line.
In VLIB, the actual image width is called as pitch. Block height is simply called height and block width is simply called width.
Please feel free to ask for more clarification.
Regards
Senthil
Hello,
There seems to be a bug in the html script generated.
Apologies for the screwed up alignment.
Regards
Senthil
Thanks a lot. Senthil. This helps me a lot. I did study the example for VLIB for a while.
What confused me in VLIB document is the following: (Page 33, 14.2.3 Method)
1) "The input cols and pitch must be multiples of 64". My understanding is the double-word requirement for efficient computing. Then obviously 720 is NOT.
2) "If the data is a region of interest within a larger image, then pitch < cols." So the data refers to the actual image(red)? and a larger image is the blue area? Then in this case, how to obtain pitch < cols? cols refers to the width of the actually image (red), right?
From your code, then cols = pitch = 720. The example of VLIB shows a special case with width of 64. But for 720, I still have misalignment in the output display. Here is what I have for the display:
1) The upper half, it shows a misalignment of three channels since in the end, I convert the binary to YUV for display.
2) The bottom half, some unknown display.
If I might have some misunderstanding here, please excuse me.
Michael,
The documentation seems to have a few errors.
1) "The input cols and pitch must be multiples of 64."
The code requires only word alignment. So pitch and cols should be a multiple of 32.
Even then 720 does not satisfy the criteria. You could try padding with zeros or removing the end pixels to make it satisfy the above constraint.
This may not be the optimal way though.
2) "pitch <cols" should be "pitch>cols". It is a typo there.
I will try to find better ways of doing the step 1) and let you know.
Regards
Senthil