Spaces:
Runtime error
Runtime error
Ticket Name: Integrating Vision Algorithm on Vision SDK TDA3 | |
Query Text: | |
Other Parts Discussed in Thread: TDA2 In our project, we have algorithm for vision algorithm for adas camera monitoring system using in c. Which is already working in TDA2 EVM board. I need to integrated with framework which is based on Vision SDK provided by Texas Intruments. To under stand Vision SDK completely,i would like to do Image Negative. I have attached the image which was generated by VSDK user case generation Using user case generation, i have generated file adasens_issImageNegative_priv.c adasens_issImageNegative_priv.h My image negative input, output structure and function prototype are below. typedef struct { unsigned char *ptImageInput; //Input Image to unsigned int uiNoRows; unsigned int uiNoCols; }stImageNegativeInput; chains_vipSingleCameraEdgeDetection.c /* | |
******************************************************************************* | |
* | |
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/ | |
* ALL RIGHTS RESERVED | |
* | |
******************************************************************************* | |
*/ | |
/******************************************************************************* | |
* INCLUDE FILES | |
******************************************************************************* | |
*/ | |
#include "chains_vipSingleCameraEdgeDetection_priv.h" | |
#include <tda2xx/include/bios_chains_common.h> | |
#define CAPTURE_SENSOR_WIDTH (1280) | |
#define CAPTURE_SENSOR_HEIGHT (720) | |
/** | |
******************************************************************************* | |
* | |
* \brief SingleCameraEdgeDetectionObject | |
* | |
* This structure contains all the LinksId's and create Params. | |
* The same is passed to all create, start, stop functions. | |
* | |
******************************************************************************* | |
*/ | |
typedef struct { | |
chains_vipSingleCameraEdgeDetectionObj ucObj; | |
UInt32 captureOutWidth; | |
UInt32 captureOutHeight; | |
UInt32 displayWidth; | |
UInt32 displayHeight; | |
Chains_Ctrl *chainsCfg; | |
} Chains_VipSingleCameraEdgeDetectionAppObj; | |
/** | |
******************************************************************************* | |
* | |
* \brief Set Edge Detection Alg parameters | |
* | |
* It is called in Create function. | |
* In this function alg link params are set | |
* The algorithm which is to run on core is set to | |
* baseClassCreate.algId. The input whdth and height to alg are set. | |
* Number of input buffers required by alg are also set here. | |
* | |
* | |
* \param pPrm [IN] AlgorithmLink_EdgeDetectionCreateParams | |
* \param chainsCfg [IN] Chains_Ctrl | |
* | |
******************************************************************************* | |
*/ | |
Void chains_vipSingleCameraEdgeDetection_SetEdgeDetectionAlgPrms( | |
AlgorithmLink_EdgeDetectionCreateParams *pPrm, | |
Chains_Ctrl *chainsCfg) { | |
pPrm->maxWidth = CAPTURE_SENSOR_WIDTH; | |
pPrm->maxHeight = CAPTURE_SENSOR_HEIGHT; | |
pPrm->numOutputFrames = 3; | |
} | |
/** | |
******************************************************************************* | |
* | |
* \brief Set link Parameters | |
* | |
* It is called in Create function of the auto generated use-case file. | |
* | |
* \param pUcObj [IN] Auto-generated usecase object | |
* \param appObj [IN] Application specific object | |
* | |
******************************************************************************* | |
*/ | |
Void chains_vipSingleCameraEdgeDetection_SetAppPrms(chains_vipSingleCameraEdgeDetectionObj *pUcObj, | |
Void *appObj) { | |
Chains_VipSingleCameraEdgeDetectionAppObj *pObj | |
= (Chains_VipSingleCameraEdgeDetectionAppObj *)appObj; | |
pObj->captureOutWidth = CAPTURE_SENSOR_WIDTH; | |
pObj->captureOutHeight = CAPTURE_SENSOR_HEIGHT; | |
ChainsCommon_GetDisplayWidthHeight( | |
pObj->chainsCfg->displayType, | |
&pObj->displayWidth, | |
&pObj->displayHeight | |
); | |
ChainsCommon_SingleCam_SetCapturePrms(&(pUcObj->CapturePrm), | |
CAPTURE_SENSOR_WIDTH, | |
CAPTURE_SENSOR_HEIGHT, | |
pObj->captureOutWidth, | |
pObj->captureOutHeight, | |
pObj->chainsCfg->captureSrc | |
); | |
ChainsCommon_SetGrpxSrcPrms(&pUcObj->GrpxSrcPrm, | |
pObj->displayWidth, | |
pObj->displayHeight | |
); | |
ChainsCommon_SetDisplayPrms(&pUcObj->Display_VideoPrm, | |
&pUcObj->Display_GrpxPrm, | |
pObj->chainsCfg->displayType, | |
pObj->displayWidth, | |
pObj->displayHeight | |
); | |
ChainsCommon_StartDisplayCtrl( | |
pObj->chainsCfg->displayType, | |
pObj->displayWidth, | |
pObj->displayHeight | |
); | |
chains_vipSingleCameraEdgeDetection_SetEdgeDetectionAlgPrms | |
(&pUcObj->Alg_EdgeDetectPrm, | |
pObj->chainsCfg); | |
} | |
/** | |
******************************************************************************* | |
* | |
* \brief Start the capture display Links | |
* | |
* Function sends a control command to capture and display link to | |
* to Start all the required links . Links are started in reverce | |
* order as information of next link is required to connect. | |
* System_linkStart is called with LinkId to start the links. | |
* | |
* \param pObj [IN] Chains_VipSingleCameraEdgeDetectionAppObj | |
* | |
* \return SYSTEM_LINK_STATUS_SOK on success | |
* | |
******************************************************************************* | |
*/ | |
Void chains_vipSingleCameraEdgeDetection_StartApp(Chains_VipSingleCameraEdgeDetectionAppObj *pObj) { | |
Chains_memPrintHeapStatus(); | |
ChainsCommon_StartDisplayDevice(pObj->chainsCfg->displayType); | |
ChainsCommon_StartCaptureDevice( | |
pObj->chainsCfg->captureSrc, | |
pObj->captureOutWidth, | |
pObj->captureOutHeight,1 | |
); | |
chains_vipSingleCameraEdgeDetection_Start(&pObj->ucObj); | |
Chains_prfLoadCalcEnable(TRUE, FALSE, FALSE); | |
} | |
/** | |
******************************************************************************* | |
* | |
* \brief Delete the capture display Links | |
* | |
* Function sends a control command to capture and display link to | |
* to delete all the prior created links | |
* System_linkDelete is called with LinkId to delete the links. | |
* | |
* \param pObj [IN] Chains_VipSingleCameraEdgeDetectionAppObj | |
* | |
******************************************************************************* | |
*/ | |
Void chains_vipSingleCameraEdgeDetection_StopAndDeleteApp(Chains_VipSingleCameraEdgeDetectionAppObj | |
*pObj) { | |
chains_vipSingleCameraEdgeDetection_Stop(&pObj->ucObj); | |
chains_vipSingleCameraEdgeDetection_Delete(&pObj->ucObj); | |
ChainsCommon_StopDisplayCtrl(); | |
ChainsCommon_StopCaptureDevice(pObj->chainsCfg->captureSrc); | |
ChainsCommon_StopDisplayDevice(pObj->chainsCfg->displayType); | |
/* Print the HWI, SWI and all tasks load */ | |
/* Reset the accumulated timer ticks */ | |
Chains_prfLoadCalcEnable(FALSE, TRUE, TRUE); | |
} | |
/** | |
******************************************************************************* | |
* | |
* \brief Single Channel Capture Display usecase function | |
* | |
* This functions executes the create, start functions | |
* | |
* Further in a while loop displays run time menu and waits | |
* for user inputs to print the statistics or to end the demo. | |
* | |
* Once the user inputs end of demo stop and delete | |
* functions are executed. | |
* | |
* \param chainsCfg [IN] Chains_Ctrl | |
* | |
******************************************************************************* | |
*/ | |
Void Chains_vipSingleCameraEdgeDetection(Chains_Ctrl *chainsCfg) { | |
char ch; | |
UInt32 done = FALSE; | |
Chains_VipSingleCameraEdgeDetectionAppObj chainsObj; | |
chainsObj.chainsCfg = chainsCfg; | |
chains_vipSingleCameraEdgeDetection_Create(&chainsObj.ucObj, &chainsObj); | |
chains_vipSingleCameraEdgeDetection_StartApp(&chainsObj); | |
while(!done) { | |
ch = Chains_menuRunTime(); | |
switch(ch) { | |
case '0': | |
done = TRUE; | |
break; | |
case 'p': | |
case 'P': | |
ChainsCommon_PrintStatistics(); | |
chains_vipSingleCameraEdgeDetection_printStatistics(&chainsObj.ucObj); | |
break; | |
default: | |
Vps_printf("\nUnsupported option '%c'. Please try again\n", ch); | |
break; | |
} | |
} | |
chains_vipSingleCameraEdgeDetection_StopAndDeleteApp(&chainsObj); | |
} | |
typedef struct { unsigned char *ptImageOutput; }stImageNegativeOutput; void ImageNegative(&stImageNegatvieInput,&stImageNegativeOutput); Assume that, chains_vipSingleCameraEdgeDetection.c(attched with this) is performing image negative. I have to call the ImageNegative for each frame. Can you please tell me, where i have to exactly call my ImageNegative fuctions and initialize the input and output structures. | |
Responses: | |
Hi, Algorithm is integrated into Algorithm Link in Vision SDK. You have to create an algorithm link plug-in for your algorithm. Please refer to Chapter 4 in Vision SDK Development Guide. For example, you can refer to ~\VISION_SDK_02_xx_xx_xx\vision_sdk\examples\tda2xx\src\alg_plugins\edgedetection. | |