Jetson Inference
DNN Vision Library
cudaDraw.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20  * DEALINGS IN THE SOFTWARE.
21  */
22 
23 #ifndef __CUDA_DRAW_H__
24 #define __CUDA_DRAW_H__
25 
26 
27 #include "cudaUtility.h"
28 #include "imageFormat.h"
29 
30 
35 cudaError_t cudaDrawCircle( void* input, void* output, size_t width, size_t height, imageFormat format,
36  int cx, int cy, float radius, const float4& color );
37 
42 template<typename T>
43 cudaError_t cudaDrawCircle( T* input, T* output, size_t width, size_t height,
44  int cx, int cy, float radius, const float4& color )
45 {
46  return cudaDrawCircle(input, output, width, height, imageFormatFromType<T>(), cx, cy, radius, color);
47 }
48 
53 inline cudaError_t cudaDrawCircle( void* image, size_t width, size_t height, imageFormat format,
54  int cx, int cy, float radius, const float4& color )
55 {
56  return cudaDrawCircle(image, image, width, height, format, cx, cy, radius, color);
57 }
58 
63 template<typename T>
64 cudaError_t cudaDrawCircle( T* image, size_t width, size_t height,
65  int cx, int cy, float radius, const float4& color )
66 {
67  return cudaDrawCircle(image, width, height, imageFormatFromType<T>(), cx, cy, radius, color);
68 }
69 
70 
75 cudaError_t cudaDrawLine( void* input, void* output, size_t width, size_t height, imageFormat format,
76  int x1, int y1, int x2, int y2, const float4& color, float line_width=1.0 );
77 
82 template<typename T>
83 cudaError_t cudaDrawLine( T* input, T* output, size_t width, size_t height,
84  int x1, int y1, int x2, int y2, const float4& color, float line_width=1.0 )
85 {
86  return cudaDrawLine(input, output, width, height, imageFormatFromType<T>(), x1, y1, x2, y2, color, line_width);
87 }
88 
93 inline cudaError_t cudaDrawLine( void* image, size_t width, size_t height, imageFormat format,
94  int x1, int y1, int x2, int y2, const float4& color, float line_width=1.0 )
95 {
96  return cudaDrawLine(image, image, width, height, format, x1, y1, x2, y2, color, line_width);
97 }
98 
103 template<typename T>
104 cudaError_t cudaDrawLine( T* image, size_t width, size_t height,
105  int x1, int y1, int x2, int y2, const float4& color, float line_width=1.0 )
106 {
107  return cudaDrawLine(image, width, height, imageFormatFromType<T>(), x1, y1, x2, y2, color, line_width);
108 }
109 
110 
115 cudaError_t cudaDrawRect( void* input, void* output, size_t width, size_t height, imageFormat format,
116  int left, int top, int right, int bottom, const float4& color,
117  const float4& line_color=make_float4(0,0,0,0), float line_width=1.0f );
118 
123 template<typename T>
124 cudaError_t cudaDrawRect( T* input, T* output, size_t width, size_t height,
125  int left, int top, int right, int bottom, const float4& color,
126  const float4& line_color=make_float4(0,0,0,0), float line_width=1.0f )
127 {
128  return cudaDrawRect(input, output, width, height, imageFormatFromType<T>(), left, top, right, bottom, color, line_color, line_width);
129 }
130 
135 inline cudaError_t cudaDrawRect( void* image, size_t width, size_t height, imageFormat format,
136  int left, int top, int right, int bottom, const float4& color,
137  const float4& line_color=make_float4(0,0,0,0), float line_width=1.0f )
138 {
139  return cudaDrawRect(image, image, width, height, format, left, top, right, bottom, color, line_color, line_width);
140 }
141 
146 template<typename T>
147 cudaError_t cudaDrawRect( T* image, size_t width, size_t height,
148  int left, int top, int right, int bottom, const float4& color,
149  const float4& line_color=make_float4(0,0,0,0), float line_width=1.0f )
150 {
151  return cudaDrawRect(image, image, width, height, imageFormatFromType<T>(), left, top, right, bottom, color, line_color, line_width);
152 }
153 
154 #endif
cudaDrawLine
cudaError_t cudaDrawLine(void *input, void *output, size_t width, size_t height, imageFormat format, int x1, int y1, int x2, int y2, const float4 &color, float line_width=1.0)
cudaDrawLine
cudaUtility.h
color
uchar3 color
The RGB color of the point.
Definition: cudaPointCloud.h:11
cudaDrawCircle
cudaError_t cudaDrawCircle(void *input, void *output, size_t width, size_t height, imageFormat format, int cx, int cy, float radius, const float4 &color)
cudaDrawCircle
cudaDrawRect
cudaError_t cudaDrawRect(void *input, void *output, size_t width, size_t height, imageFormat format, int left, int top, int right, int bottom, const float4 &color, const float4 &line_color=make_float4(0, 0, 0, 0), float line_width=1.0f)
cudaDrawRect
make_float4
__host__ __device__ float4 make_float4(float s)
Definition: cudaMath.h:248
imageFormat.h
imageFormat
imageFormat
The imageFormat enum is used to identify the pixel format and colorspace of an image.
Definition: imageFormat.h:49