fixed build errors

This commit is contained in:
Marcel Lütke Dreimann
2025-06-23 12:51:27 +02:00
parent 9c47b881f6
commit 515205683b

View File

@@ -76,7 +76,7 @@ namespace fake_cv
m.step = width * sizeof(float); m.step = width * sizeof(float);
const size_t size = m.rows * m.cols; const size_t size = m.rows * m.cols;
m.data = new float[size]; m.data = (float*)malloc(size * sizeof(float));
for (size_t i = 0; i < size; ++i) for (size_t i = 0; i < size; ++i)
{ {
@@ -286,7 +286,7 @@ int main(int argc, char **argv)
// printf("numPlatforms:%d\n",numPlatforms); // printf("numPlatforms:%d\n",numPlatforms);
if (0 < numPlatforms) if (0 < numPlatforms)
{ {
cl_platform_id *platforms = new cl_platform_id[numPlatforms]; cl_platform_id *platforms = (cl_platform_id*)malloc(numPlatforms * sizeof(cl_platform_id));
status = clGetPlatformIDs(numPlatforms, platforms, NULL); status = clGetPlatformIDs(numPlatforms, platforms, NULL);
char platformName[100]; char platformName[100];
for (unsigned i = 0; i < numPlatforms; ++i) for (unsigned i = 0; i < numPlatforms; ++i)
@@ -301,7 +301,7 @@ int main(int argc, char **argv)
//platformVendor.assign(platformName); //platformVendor.assign(platformName);
} }
//std::cout << "Platform found : " << platformName << "\n"; //std::cout << "Platform found : " << platformName << "\n";
delete[] platforms; free(platforms);
} }
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL); status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, &device, NULL);
@@ -414,7 +414,7 @@ int main(int argc, char **argv)
intImgHost.rows = img.rows; intImgHost.rows = img.rows;
intImgHost.cols = img.cols; intImgHost.cols = img.cols;
intImgHost.step = sizeof(float); intImgHost.step = sizeof(float);
intImgHost.data = new float[img.cols * img.rows]; intImgHost.data = (float*) malloc(img.cols * img.rows * sizeof(float));
#endif // OCV #endif // OCV
struct timeval tInt1, tInt2; struct timeval tInt1, tInt2;
@@ -436,7 +436,7 @@ int main(int argc, char **argv)
} }
fclose(fp); fclose(fp);
#ifndef OCV #ifndef OCV
delete[] intImgHost.data; free(intImgHost.data);
#endif // OCV #endif // OCV
#endif #endif
@@ -1091,7 +1091,7 @@ mid = clCreateBuffer(context,
// cvReleaseImage(&img); // cvReleaseImage(&img);
#ifndef OCV #ifndef OCV
delete[] img.data; free(img.data);
#endif // OCV #endif // OCV
// Print the number of interest points // Print the number of interest points