Comments (4)
if( flags & OVERLAY_BOX )
{
// Draw bounding box overlays once for all detections
if( CUDA_FAILED(cudaDetectionOverlay(input, output, width, height, format, detections, numDetections, mClassColors)) )
return false;
// Then iterate over each detection to draw the centroid circles
for( int n=0; n < numDetections; n++ )
{
const Detection* d = detections + n;
// Use the Center function to calculate the center coordinates
float cx, cy;
d->Center(&cx, &cy);
// Adjust the radius as needed
float radius = 12.5f; // Use this variable or decide if you want to use a fixed value
// Draw the centroid circle for the current detection
if( CUDA_FAILED(cudaDrawCircle((uchar3*)output, width, height, static_cast<int>(cx), static_cast<int>(cy), radius, make_float4(255,0,0,200)))) // Corrected line
return false;
}
}
Just simply casting the output to one of the supported formats worked! Thank you.
from jetson-inference.
from jetson-inference.
Hi @ImTheMan153, the detectNet::Detection
struct has a Center() function which will return the centroid, and there are these CUDA functions for drawing basic shapes:
jetson-inference/c/detectNet.h
Line 159 in fe8b42c
- https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-image.md#drawing-shapes
There are Python analogs of these too.
from jetson-inference.
Hi dusty,
Thank you for the reply. I changed the code to whatever you told me to go with, however, I get the same output as the gif shown above. If I remove the cuda circle loop, I am properly getting the overlay of the detection. If I use drawcircle function from jetson utils as per the repo you shared and make my build, it shows an error saying that it expects my input image to be some specific formats. I am attaching the error below.
/home/ubuntu/jetson-inference/build/aarch64/include/jetson-utils/cudaDraw.h:67:68: required from ‘cudaError_t cudaDrawCircle(T*, size_t, size_t, int, int, float, const float4&) [with T = void; cudaError_t = cudaError; size_t = long unsigned int; float4 = float4]’ /home/ubuntu/jetson-inference/c/detectNet.cpp:1024:13: required from here /home/ubuntu/jetson-inference/build/aarch64/include/jetson-utils/imageFormat.inl:234:48: error: static assertion failed: invalid image format type - supported types are uchar3, uchar4, float3, float4 234 | static_assert(__image_format_assert_false<T>::value, "invalid image format type - supported types are uchar3, uchar4, float3, float4"); | ^~~~~ make[2]: *** [CMakeFiles/jetson-inference.dir/build.make:1473: CMakeFiles/jetson-inference.dir/c/detectNet.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:447: CMakeFiles/jetson-inference.dir/all] Error 2
Source code (just the overlay function) for now:
if( flags & OVERLAY_BOX )
{
// Draw bounding box overlays once for all detections
if( CUDA_FAILED(cudaDetectionOverlay(input, output, width, height, format, detections, numDetections, mClassColors)) )
return false;
// Then iterate over each detection to draw the centroid circles
for( int n=0; n < numDetections; n++ )
{
const Detection* d = detections + n;
// Use the Center function to calculate the center coordinates
float cx, cy;
d->Center(&cx, &cy);
// Adjust the radius as needed
float radius = 12.5f;
// Draw the centroid circle for the current detection
// Ensure that the format of the image and the call to cudaDrawCircle are compatible
if( CUDA_FAILED(cudaDrawCircle(input, output, width, height, format, static_cast<int>(cx), static_cast<int>(cy), radius, make_float4(255,0,0,200))))
return false;
}
}
I tried a different cuda draw circle function according to the source code shown above, but it works the same way as the gif.
If you know the fix, please send me the modified function. I will try it out and let you know!
from jetson-inference.
Related Issues (20)
- Web-RTC dash not have argument on app.py
- [TRT] 2: [utils.cpp::checkMemLimit::380] Error Code 2: Internal Error (Assertion upperBound != 0 failed. Unknown embedded device
- SyntaxError: future feature annotations is not defined HOT 2
- where is file named train_ssd.py ? HOT 2
- cudaEventElapsedTime device not ready (error 600) (hex 0x258) HOT 1
- [ WARN:0] global /opt/opencv/modules/videoio/src/cap_gstreamer.cpp (935)
- How to open csi camera in a docker container HOT 3
- How to use custom .onnx or .tflite model with inference ? HOT 1
- Problem with testing video viewer function HOT 7
- choose network precision as float32 HOT 1
- Questions about how to receive and use ROS1 image msg
- RuntimeError: CUDA error: too many resources requested for launch
- how to get networks/FlowNet-320x240/flownets.onnx HOT 2
- Action Recognition gets crashed after running for couple of seconds
- Fail to load vgg-16 for inferencing on Jetson Nano 4GB HOT 1
- detectnet with GMSL Camera
- Is there a way to manually EOS in python object? HOT 2
- How to save videos through videosource, instead of using output.render HOT 1
- MobileNetV3 constant dips in accuracy.
- unable to download ResNet18-Tagging-VOC/resnet18.onnx
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetson-inference.