We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I'm searching for a fast way to substract a dark image from another image. If the dark image pixel value is greater than the corresponding image pixel, the resulting image pixel should be zero. Otherwise, it should be simply substracted.
Are there special functions for doing this job?
I got an AT91SAM9260 processor and the image data is 10bit depth, laying in a 16-bit array.
Many thank, Stefan
Stefan; I don't know your image size or your dynamic range but for limited range a Look Up Table (LUT) would be a very fast routine. The table would be filled with your dark image values and the real image value would index into the dark image array for the new value. This is a common hardware approach to pre-processing of images for machine control. Of course if your dark image values are dynamic as well as the real image this would not work. For a number of algorithms, look at "The Handbook of Astronomical Image Processing" by Richard Berry. ISBN 0-943396-67-0. I'm sure there is a much later edition. While it leans to Astrometry, images are images.
I suppose the answer is hand-crafted assembly code.
Possibly, but the compiler should be able to take care of much of the necessary optimization. At least that's my experience - I tried beating the compiler with hand-crafted assembly in a similar scenario (by maximizing register usage and memory throughput by using load/store multiple instructions), and the compiler still ended up ahead.
However, some things (like manually unrolling the loop, at least partially) might still have to be done by hand.
I suppose the answer is hand-crafted assembly code. Get a ARM9 instruction set guide, with instruction timings. And don't forget to maximize memory throughput as well.