
Last week we submitted a paper to ICFP about how to implement efficient parallel stencil convolutions in Haskell. This goes along with a new release of Repa that runs on GHC 7.0.3. We've extended the old array representation to support the partitioning of arrays into several regions, and rewritten the back-end to recover sharing between the computation of adjacent array elements. Coupled with a careful management of aliasing issues, this lets us implement image processing algorithms that have comparable performance to OpenCV.
Absolute performance depends on what data format we're using. Using Word8s is about 4 times slower than OpenCV because it uses SIMD intrinsics that we don't have access to from Haskell (yet!). On the other hand, using Float32s and 2 Haskell threads can run faster than single threaded OpenCV, as the parallelism makes up for the lack of SIMD instructions.
Here is a video of me demonstrating a Canny edge detector applied to a stream captured from my iSight camera. The demo uses Objective C for the GUI, and Haskell for the processing. The source builds with XCode 3.2.1 and GHC 7.0.3, though you'll need to update and run the CONFIGURE.sh script in the root dir to point it to your GHC install. There are also prebuilt versions with the GHC "+RTS -N" option baked in for two, four and six threads. They all do the same thing apart from the number of threads. You can change the RTS options in the main.m module if you want to rebuild it. On my 4-Core i7 desktop it does about 20 frames per second with no problem -- the framerate from the iSight is set dynamically by OSX depending on system load. I've tested it on 3 separate machines, but let me know if it doesn't work for you. Non-Mac users can run the edge detector over .bmp files, using the repa-canny program from repa-examples.
As someone with an interest in CV and Haskell, this is an inspiring achievement. Congratulations :-)
ReplyDeleteThis article presents an impressive implementation of parallel stencil convolutions and real-time Canny edge detection using Haskell and the Repa library. The discussion on array partitioning, shared computation, parallel processing, and performance optimization demonstrates how advanced image processing algorithms can achieve competitive performance for real-time computer vision applications. The comparison with OpenCV also provides valuable insights into the challenges and opportunities of high-performance image analysis.
ReplyDeleteFeature extraction, edge detection, and real-time image analysis are fundamental concepts in Image Processing Projects for Final Year. Practical exposure to these techniques enables students to develop intelligent visual systems for applications such as object detection, medical imaging, surveillance, and autonomous systems.
ReplyDeleteThe article also highlights how modern computer vision continues to evolve with AI-driven approaches for feature learning and visual understanding. Exploring Deep Learning Projects for Final Year can help students build advanced image analysis models capable of performing object recognition, image classification, and scene understanding with greater accuracy and efficiency.
ReplyDelete