96
edits
Changes
Sirius
,→Assignment 3
For me the most important thing is to solve the problem regardless of the tools used and I think that reimplementing everything from scratch using OpenCV and CUDA is a viable solution.
=== Source Code for Vehicle Detection===<syntaxhighlight lang="cpp">void detect_vehicles() { for (unsigned int i = 0; i < files.size(); i++) { // Load one image at the time and display it load_image(img, files[i]); win.set_image(img); // Run the detector on the image and show the output for (auto&& d : net(img)) { auto fd = sp(img, d); rectangle rect; for (unsigned long j = 0; j < fd.num_parts(); ++j) rect += fd.part(j); if (d.label == "rear") win.add_overlay(rect, rgb_pixel(255, 0, 0), d.label); else win.add_overlay(rect, rgb_pixel(255, 255, 0), d.label); } // Clear the overlay dlib::sleep(1000); win.clear_overlay(); }}</syntaxhighlight>
=== Box Blur on an image using opencv C++ Library (Max Fainshtein) ===
<syntaxhighlight lang="cpp>
int iDevice;
cudaDeviceProp prop;
cudaGetDevice(&iDevice);
resident_blocks = 32;
}
//determine threads/block dim3 blockDims(resident_threads/resident_blocks,1,1);
//Calculate grid size to cover the whole image