Yes, it is. By bitmap, I am assuming you mean raw binary data of the RGB stuff. Once you have that, you would have to really know what it is that you are doing to manipulate the data on a byte by byte level to make the image appear blurred. It would probably be much easier to use some high level api, but then that wouldn't really be standard c++ =)
Maybe FreeImage has routines for blur?
Kip
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I may offer a stupid suggestion (I can have many ideas on many subjects even if I know little of these)...
Is blurring not something as simple as mixing a pixels color with the colors of the surrounding ones ?
(of course weighting the "mixing" depending on the distance between the pixel and the considered surrounding one)
As I said, it's just a stupid suggestion...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, I may be off here, because I think of this as a physics problems (blur from a circular aperture stuff), but assuming you have a blur function
f(x,y)
where x is the distance from the pixel you are blurring into from the pixel you are blurring out of, then the overall blurring into a given pixel i0, j0, due to other pixels would be a sum over I and j of
f(i - i0,j-j0) * P(i,j)
Where P(i,j) represents the contents of Pixel(i,j) - I like to think of it as the power falling on that pixel, but that is because I spend a large fraction of my life working with infrared detectors.
Generally you sum only out about 3 rows and columns from i0,j0.
The form of F(x,y) can be a gaussian, an Airy blur function or pretty much anything you want to try.
If this is massively unclear, I apologize, as I am used to thinking of this problem from a modeling of the response of infrared detector arrays standpoint, not so much a blurring of pictures standpoint.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> If it is so simple then show a algorithm or pseudocode.
I could do it if I had time; but I don't. :-)
And I don't know if bluring is supposed to be done this way.
I was just making a suggestion so one can try it if he thinks it worth.
And, anyway, as I see the theory is quite simple; it would be something like that :
For each pixel (r,g,b)(x,y) in your bitmap
the pixel of the resulting image is (r1,g1,b1)
with
r1 = coef0r(x,y) + coef1r(x-1,y-1) + coef1r(x,y-1) + coef1r(x+1,y-1) + ...
g1 = coef0g(x,y) + coef1g(x-1,y-1) + coef1g(x,y-1) + coef1g(x+1,y-1) + ...
b1 = coef0b(x,y) + coef1b(x-1,y-1) + coef1b(x,y-1) + coef1b(x+1,y-1) + ...
and so on, including pixels further with lighter coefficients, and also possibly use slightly lighter coefficient for the pixels in the diagonals because they are little further than those on the sides.
The sum of the coefficients should be 1.
Of course, implementing that in an efficient way might prove more difficult than just explaining the principle; but, then again, if it were too easy where would be the fun ? :-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is it possible to blur a bitmap image with standard C++.
Yes, it is. By bitmap, I am assuming you mean raw binary data of the RGB stuff. Once you have that, you would have to really know what it is that you are doing to manipulate the data on a byte by byte level to make the image appear blurred. It would probably be much easier to use some high level api, but then that wouldn't really be standard c++ =)
Maybe FreeImage has routines for blur?
Kip
If I may offer a stupid suggestion (I can have many ideas on many subjects even if I know little of these)...
Is blurring not something as simple as mixing a pixels color with the colors of the surrounding ones ?
(of course weighting the "mixing" depending on the distance between the pixel and the considered surrounding one)
As I said, it's just a stupid suggestion...
If it is so simple then show a algorithm or pseudocode.
Well, I may be off here, because I think of this as a physics problems (blur from a circular aperture stuff), but assuming you have a blur function
f(x,y)
where x is the distance from the pixel you are blurring into from the pixel you are blurring out of, then the overall blurring into a given pixel i0, j0, due to other pixels would be a sum over I and j of
f(i - i0,j-j0) * P(i,j)
Where P(i,j) represents the contents of Pixel(i,j) - I like to think of it as the power falling on that pixel, but that is because I spend a large fraction of my life working with infrared detectors.
Generally you sum only out about 3 rows and columns from i0,j0.
The form of F(x,y) can be a gaussian, an Airy blur function or pretty much anything you want to try.
If this is massively unclear, I apologize, as I am used to thinking of this problem from a modeling of the response of infrared detector arrays standpoint, not so much a blurring of pictures standpoint.
Wayne
> If it is so simple then show a algorithm or pseudocode.
I could do it if I had time; but I don't. :-)
And I don't know if bluring is supposed to be done this way.
I was just making a suggestion so one can try it if he thinks it worth.
And, anyway, as I see the theory is quite simple; it would be something like that :
For each pixel (r,g,b)(x,y) in your bitmap
the pixel of the resulting image is (r1,g1,b1)
with
r1 = coef0r(x,y) + coef1r(x-1,y-1) + coef1r(x,y-1) + coef1r(x+1,y-1) + ...
g1 = coef0g(x,y) + coef1g(x-1,y-1) + coef1g(x,y-1) + coef1g(x+1,y-1) + ...
b1 = coef0b(x,y) + coef1b(x-1,y-1) + coef1b(x,y-1) + coef1b(x+1,y-1) + ...
and so on, including pixels further with lighter coefficients, and also possibly use slightly lighter coefficient for the pixels in the diagonals because they are little further than those on the sides.
The sum of the coefficients should be 1.
Of course, implementing that in an efficient way might prove more difficult than just explaining the principle; but, then again, if it were too easy where would be the fun ? :-)