As an educational exercise for me, I am writing an application that can average a bunch of images. It is often used in astrofotography to reduce the noise.
The library I am using is Magic ++ and I have actually succeeded in writing the application. But, unfortunately, its slow speed I am using this code: Average 10 images of the code by going through each pixel and adding pixel intensity of each channel to double vector average Then takes the vector as a parameter and the average of the result. This average is then used on the corresponding pixel in the stacked image - which is the resultant image it works just fine but as I mentioned, I am not happy with the speed on the core i5 machine It takes 2 minutes and 30 seconds. The picture is 8 megapixels and 16 bit TIFF. I think that it has a lot of data, but I have done it faster in other applications. Is it slow to loop or pixel color (x, y) is the way to reach the pixels in an image? What is a fast way? Why use vectors / arrays in all? Why not This vector avoids 36 function calls per object per pixel. and you can get even better performance by using the full then " Low-level image pixel access "view section Now you have removed 10 calls to pixel collar, 10 color RGB constructor and 30 accuser function in 10 pixels. Note, this is all the principle; I have not tested any of these
double red = 0.0, blue = 0.0, green = 0.0; For (i = 1; i <-10; i ++) {color RGB RGB (image [i]. Pixel color (column, row)); Red + = rgb.red (); Blue = + rgb.blue (); Green + = rgb.green (); } Red / 10 =; Blue / = 10; Green / = 10;
PixelCache image instead of the original
image objects
pixelpacket * pix = cache [i] + row * column + column; Red + = pix- & gt; Red; Blue + = px-> Blue; Green + = picture-> Green;
Comments
Post a Comment