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.

TDA4VM: How to get 4ch image on SDK7_3

Part Number: TDA4VM

Hi

expert

I'm tring to get 4ch raw image.
I believe serdes and sensor setting are correct.
I confirmed 1ch image is saved using 4ch serdes and sensor setting value.
but I can not see the images of 4ch.

error

Q1. I want to know how to separate each image on CSIRX. maybe virtual channel?

Q2. How to recognize 4ch image to CaptureNode() and save each image to buffer(obj->cap_frames).
Q3. Is attached code correct to save 4ch raw image?

vx_status app_klk_create_graph(AppObj *obj){

    /* common */
    vx_status   status = VX_SUCCESS;
	vx_context  context = obj->context;
    vx_int32    file_size = 0;

	tivx_capture_params_t capture_params;


    /* sdk */
    tivx_raw_image raw_image = NULL;
    vx_user_data_object capture_config;

    if (vx_true_e == tivxIsTargetEnabled(TIVX_TARGET_CAPTURE1))
	{		
        obj->graph = vxCreateGraph(context);
       	if (vxGetStatus((vx_reference)obj->graph) != VX_SUCCESS){
			printf("[ERR] vxCreateGraph fail\n");
		}

        /***Initializing params for capture node***/
        memset(&sensorParams, 0, sizeof(sensorParams));

        sensorParams.sensorInfo.raw_params.width                        = 1280U;
        sensorParams.sensorInfo.raw_params.height                       = 944U;
        sensorParams.sensorInfo.raw_params.num_exposures                = 1U;
        sensorParams.sensorInfo.raw_params.line_interleaved             = vx_false_e; 
        sensorParams.sensorInfo.raw_params.format[0].pixel_container    = TIVX_RAW_IMAGE_16_BIT;
        sensorParams.sensorInfo.raw_params.format[0].msb                = 11U;
        // sensorParams.sensorInfo.raw_params.format[1].pixel_container    = TIVX_RAW_IMAGE_16_BIT;
        // sensorParams.sensorInfo.raw_params.format[1].msb                = 11U;
        // sensorParams.sensorInfo.raw_params.format[2].pixel_container    = TIVX_RAW_IMAGE_16_BIT;
        // sensorParams.sensorInfo.raw_params.format[2].msb                = 11U;
        sensorParams.sensorInfo.raw_params.meta_height_before           = 0U;
        sensorParams.sensorInfo.raw_params.meta_height_after            = 4U; 

        raw_image = tivxCreateRawImage(obj->context, &sensorParams.sensorInfo.raw_params);

        vxSetReferenceName((vx_reference)raw_image, "RAW_IMAGE");
        //for(buf_id=0; buf_id<obj->num_cap_buf; buf_id++) {            
            obj->cap_frames[0] = vxCreateObjectArray(obj->context, (vx_reference)raw_image, 4);
            status = vxGetStatus((vx_reference) obj->cap_frames[0]);
            if(status != VX_SUCCESS){
                printf("[ERR] vxCreateObjectArray fail\n");
            }            
        //}
        
        tivx_capture_params_init(&capture_params);
        capture_params.numInst                      = 1U; /* Configure both instances */
        capture_params.numCh                        = 4U; /* Single cam. Only 1 channel enabled */
        capture_params.timeout                      = 33;
        capture_params.timeoutInitial               = 500;
       
        capture_params.instId[0]                        = 0u;
        capture_params.instCfg[0].enableCsiv2p0Support  = (uint32_t)vx_true_e;
        capture_params.instCfg[0].numDataLanes          = 2u;
        capture_params.instCfg[0].dataLanesMap[0u]      = 1u;
        capture_params.instCfg[0].dataLanesMap[1u]      = 2u;
        capture_params.instCfg[0].laneBandSpeed         = TIVX_CAPTURE_LANE_BAND_SPEED_1350_TO_1500_MBPS;  

        int cnt = 0;
        for (cnt = 0u; cnt < TIVX_CAPTURE_MAX_CH; cnt ++)
        {
            capture_params.chVcNum[cnt]   = cnt;
            capture_params.chInstMap[cnt] = 0U;
        }		

        capture_config = vxCreateUserDataObject(context, "tivx_capture_params_t",
				sizeof(tivx_capture_params_t), &capture_params);
		if (vxGetStatus((vx_reference)capture_config) != VX_SUCCESS) {
			printf("[ERR] vxCreateUserDataObject fail\n");
			return VX_FAILURE;
		}
        vxSetReferenceName((vx_reference)capture_config, "CAP_CFG");
        
		obj->capture_node = tivxCaptureNode(obj->graph, capture_config,
				obj->cap_frames[0]);
		if (vxGetStatus((vx_reference)obj->capture_node) != VX_SUCCESS){
			printf("[ERR] tivxCaptureNode fail\n");
			return VX_FAILURE;
		}
        vxSetReferenceName((vx_reference)obj->capture_node, "CAP_NODE");

        status = vxReleaseUserDataObject(&capture_config);
        if(status != VX_SUCCESS){
            printf("[ERR] vxReleaseUserDataObject fail\n");
        }
        status = vxSetNodeTarget(obj->capture_node, VX_TARGET_STRING, TIVX_TARGET_CAPTURE1);//sdk는 TIVX_TARGET_CAPTURE2
        if(status != VX_SUCCESS){
            printf("[ERR] vxSetNodeTarget fail\n");
        }
		
        status = vxVerifyGraph(obj->graph);
        if(status != VX_SUCCESS){
            printf("[ERR] vxVerifyGraph fail\n");
        }

        status = tivxExportGraphToDot(obj->graph, ".", "klk_single_cam");
        if(status != VX_SUCCESS){
            printf("[ERR] tivxExportGraphToDot fail\n");
        }

        //run graph
        status = appStartImageSensor("OX01D10", 1); // setup serdes, sensor
        tivxTaskWaitMsecs(5000);

        printf(" [INFO] Executing graph ... !!!\n");
        vxScheduleGraph(obj->graph);

        vxWaitGraph(obj->graph);

        printf(" [INFO] Executing graph ... Done !!!\n");

        obj->raw = (tivx_raw_image)vxGetObjectArrayItem(obj->cap_frames[0], 0);
   
        file_size = write_output_image_raw("/ti_fs/vision_apps/raw_image0.raw", obj->raw);
        printf(" [INFO] raw_0 file size:%d\n", file_size);

        obj->raw = (tivx_raw_image)vxGetObjectArrayItem(obj->cap_frames[0], 1);

        file_size = write_output_image_raw("/ti_fs/vision_apps/raw_image1.raw", obj->raw);
        printf(" [INFO] raw_1 file size:%d\n", file_size);

        obj->raw = (tivx_raw_image)vxGetObjectArrayItem(obj->cap_frames[0], 2);
 
        file_size = write_output_image_raw("/ti_fs/vision_apps/raw_image2.raw", obj->raw);
        printf(" [INFO] raw_2 file size:%d\n", file_size);
   
        obj->raw = (tivx_raw_image)vxGetObjectArrayItem(obj->cap_frames[0], 3);

        file_size = write_output_image_raw("/ti_fs/vision_apps/raw_image3.raw", obj->raw);
        printf(" [INFO] raw_3 file size:%d\n", file_size);
        // file_size = write_output_image_nv12_8bit("/ti_fs/vision_apps/yuv_image1.yuv", obj->y8_r8_c2);
        // printf(" [INFO] yuv file size:%d\n", file_size);

        //release

    } else {
        printf("[ERR] tivxIsTargetEnabled fail \n");
    }

    return status;
}

I changed a part of code to save 1ch image. only A port image.

line44: obj->cap_frames[0] = vxCreateObjectArray(obj->context, (vx_reference)raw_image, 1);

line51: capture_params.numCh                        = 1U;

 

Thank you