Tool/software:
I'm using the tivxVpacMscPyramidNode to get different size picture, it seems that i can only get the level 0's picture, other levels' picture is black. The tivxVpacMscPyramidNode's level is setted to 4.
Only the marked line's output is ok;
code is bellow:
vx_status writePyramidOutput(char *file_name, vx_pyramid pyramid, vx_int32 pyramid_level)
{
vx_status status;
FILE *fp = fopen(file_name, "wb");
vx_image out_img;
out_img = vxGetPyramidLevel(pyramid, pyramid_level);
vx_rectangle_t rect;
vx_imagepatch_addressing_t image_addr;
vx_map_id map_id;
void *data_ptr;
vx_uint32 img_width;
vx_uint32 img_height;
vx_uint32 num_bytes = 0;
vx_df_image df;
vxQueryImage(out_img, VX_IMAGE_WIDTH, &img_width, sizeof(vx_uint32));
vxQueryImage(out_img, VX_IMAGE_HEIGHT, &img_height, sizeof(vx_uint32));
vxQueryImage(out_img, VX_IMAGE_FORMAT, &df, sizeof(vx_df_image));
printf("image_width %d.\n", img_width);
printf("image_height %d.\n", img_height);
printf("image_format %d.\n", df);
if (df == VX_DF_IMAGE_U8)
{
printf("image is u8.\n");
}
else
{
printf("image is not u8.\n");
}
rect.start_x = 0;
rect.start_y = 0;
rect.end_x = img_width;
rect.end_y = img_height;
fprintf(fp, "P5\n%d %d\n255\n", img_width, img_height);
status = vxMapImagePatch(out_img,
&rect,
0,
&map_id,
&image_addr,
&data_ptr,
VX_READ_ONLY,
VX_MEMORY_TYPE_HOST,
VX_NOGAP_X);
int j;
/* Copy Luma */
for (j = 0; j < img_height; j++)
{
num_bytes += fwrite(data_ptr, 1, img_width, fp);
data_ptr += image_addr.stride_y;
}
if (num_bytes != (img_width * img_height))
printf("Luma bytes written = %d, expected = %d\n", num_bytes, img_width * img_height);
vxUnmapImagePatch(out_img, map_id);
vxReleaseImage(&out_img);
fclose(fp);
return (status);
}