Question about failing to save an image (Normal situation)
lasiyan opened this issue · comments
[Environment]
- Jetson Orin AGX (Jetpack 5.0.1) GCC 9.4.0 (stdc++ 17)
[Question]
The simple code below should work fine when running in debugging mode using gdb.
But strangely, when I run it directly from the terminal (e.g. ./myAPP), I get failed on saveImage
.
Have you experienced similar symptoms?
I suspected a synchronization problem and added cudaDeviceSynchronize
right after loadImage and saveImage, but it doesn't improve.
void run()
{
Log::SetLevel(Log::Level::DEBUG);
uchar3* img;
int w, h;
if (!loadImage("test.jpg", &img, &w, &h)) {
printf("loadImage fail\n");
}
CUDA(cudaDeviceSynchronize());
printf("%02X %02X %02X\n", img->x, img->y, img->z);
if (!saveImage("res_org.jpg", img, w, h)) {
printf("saveImage fail\n");
}
CUDA(cudaDeviceSynchronize());
CUDA(cudaFreeHost(img));
}
Below are the results of the run. Is there a way to view the verbose log instead of SetLevel?
[image] loaded 'test.jpg' (1920x1080, 3 channels)
[cuda] cudaAllocMapped 6220800 bytes, CPU 0x203d8e000 GPU 0x203d8e000
24 26 21
[image] failed to save 1920x1080 image to 'res_org.jpg'
saveImage fail
I referenced this article. I'm new to CUDA, so please bear with me.
Hi @lasiyan, here is the code to saveImage()
jetson-utils/image/imageIO.cpp
Line 250 in f0bff5c
in this case, it checks the result from stbi_write_jpg()
3rd-party library function, and I'm not sure why that would work ok normally but fail under GDB