Hi,
I’m trying to use the VPI C++ API to remap my images. I’m using the following code:
#define CHECK_STATUS(STMT) \
do \
{ \
VPIStatus status = (STMT); \
if (status != VPI_SUCCESS) \
{ \
char buffer[VPI_MAX_STATUS_MESSAGE_LENGTH]; \
vpiGetLastStatusMessage(buffer, sizeof(buffer)); \
std::ostringstream ss; \
ss << vpiStatusGetName(status) << ": " << buffer; \
throw std::runtime_error(ss.str()); \
} \
} while (0);
//lut is a cv::Mat image used for the remaping of coordinates.
VPIWarpMap lut_vpi = {};
// same result when not initialising with {}
memset(&lut_vpi, 0, sizeof(lut_vpi));
lut_vpi.grid.numHorizRegions = 1;
lut_vpi.grid.numVertRegions = 1;
lut_vpi.grid.regionWidth[0] = lut.cols;
lut_vpi.grid.regionHeight[0] = lut.rows;
lut_vpi.grid.horizInterval[0] = 1;
lut_vpi.grid.vertInterval[0] = 1;
//vpiWarpMapAllocData(&lut_vpi);
CHECK_STATUS(vpiWarpMapAllocData(&lut_vpi));
{
int* offsets = (int*)lut.data;
for (int i = 0; i < lut.rows; i++)
{
VPIKeypoint *row = (VPIKeypoint *)((uint8_t *)lut_vpi.keypoints + lut_vpi.pitchBytes * i);
for (int j = 0; j < lut.cols; j++)
{
int k = *offsets++;
row[j].x = k%sensor_width;
row[j].y = k/sensor_width;
}
}
}
I’ve used the above code previously with vpi0.4(jetpack 4.4.1) with the only change being lut_vpi.strideBytes
instead of lut_vpi.pitchBytes
. Currently I’m moving to vpi1(jetpack 4.6). Now, the above code isn’t working. I’m getting:
(gdb) p lut_vpi
$32 = {grid = {numHorizRegions = 1 ‘\001’, numVertRegions = 1 ‘\001’,
regionWidth = {1120, 0, 0, 0}, regionHeight = {768, 0, 0, 0},
horizInterval = {1, 0, 0, 0}, vertInterval = {1, 0, 0, 0}},
numHorizPoints = 1152, numVertPoints = 768, pitchBytes = 1404702736,
keypoints = 0x0}
As you can see, `keypoints = 0x0.
Can you please help with identifying the issue. Thanks!
• Hardware Platform (Jetson NX)
• JetPack Version 4.6
• VPI 1
• Issue Type questions