Display in jetson inference without title bar and image blending

Good morning,

I am working on a jetson nano 2GB and I want to create a window without its titlebar. I am using the videoOutput class.
Is it possible to disable the title bar?

Another issue I have is image blending. I have used the overlay but i this function does not seem to have an alpha value.

Thank you in advance for your help!

Hi @roman.reinke, you may need to add fullscreen mode into the code, inside jetson-inference/utils/display/glDisplay.cpp (around line 322 I think)

I haven’t tried fullscreen, but it looks like this code may enable it: https://stackoverflow.com/a/28396773

Thank you, it worked perfectly,

Can you also help me with the blended images? OpenCV got a function called addweighted. But I don´t really know how to create something similiar with a cuda image.
I don´t want to convert the image to a numpy array, blend the two images and then convert it back to cuda because of time constraints.

Thank you in advance. Your help is really appreciated.

It doesn’t look like my overlay function does alpha blending, sorry about that. I originally wrote it simply to compost two images without blending. You could modify it to fit your needs though, here is the source:

I looked into your cudaOverlay file and I tried to include alpha blending. I thought I could use a similiar method as in your gpuRectFill function.
Nothing I tried works. Can you give me a hint how I could realise this?
Thank you very much.

Have you tried something like this? This is assuming that output is the base image, and input is the image being blended on top.

template<typename T>
__global__ void gpuOverlay( T* input, int inputWidth, int inputHeight, T* output, int outputWidth, int outputHeight, int x0, int y0 ) 
{
	const int input_x = blockIdx.x * blockDim.x + threadIdx.x;
	const int input_y = blockIdx.y * blockDim.y + threadIdx.y;

	const int x = input_x + x0;
	const int y = input_y + y0;
	
	if( input_x >= inputWidth || input_y >= inputHeight || x >= outputWidth || y >= outputHeight )
		return;

    T px_out = output[y * outputWidth + x];
    const T px_in = input[input_y * inputWidth + input_x];

	const float alpha = 127.5 / 255.0f;    // 50% opacity
	const float ialph = 1.0f - alpha;

	px_out.x = alpha * px_in.x + ialph * px_out.x;
	px_out.y = alpha * px_in.y + ialph * px_out.y;
	px_out.z = alpha * px_in.z + ialph * px_out.z;

	output[y * outputWidth + x] = px_out;
}

I tried something similiar. I only defined T px_in not as const.

Nevertheless the error I get if I run your code or my code is the same:

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(45): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(45): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(45): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(46): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(46): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(46): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(47): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(47): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(47): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=uint8_t]”
(89): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(45): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(45): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(45): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(46): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(46): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(46): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(47): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(47): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

/home/roman/jetson-inference/utils/cuda/cudaOverlay.cu(47): error: expression must have class type
detected during instantiation of “void gpuOverlay(T *, int, int, T *, int, int, int, int) [with T=float]”
(91): here

18 errors detected in the compilation of “/tmp/tmpxft_0000409f_00000000-8_cudaOverlay.compute_72.cpp1.ii”.
CMake Error at jetson-utils_generated_cudaOverlay.cu.o.cmake:279 (message):
Error generating file
/home/roman/jetson-inference/build/utils/CMakeFiles/jetson-utils.dir/cuda/./jetson-utils_generated_cudaOverlay.cu.o

What am I doing wrong?
Thanks for the help.

Try commenting out these lines from the cudaOverlay() function -

https://github.com/dusty-nv/jetson-utils/blob/833fc7998e34d852672277730a11aeed90024959/cuda/cudaOverlay.cu#L78

	/*else if( format == IMAGE_GRAY8 )
		launch_overlay(uint8_t);
	else if( format == IMAGE_GRAY32F )
		launch_overlay(float);*/

It worked!
Thank you very much.