How to get access to the pixels of the image using QImage?
-
I want to use Gaussian Blur filter. I wrote my 2D kernel, but to finish blurring I need to get access to pixels and change data in them. Am I able to use some operations like these within Qt library? :
QImage image("whatever.png"); for(int x(0); x < image.width(); x++) for(int y (0); y < image.height(); y++) image[x][y] *= convKernel[x-1][y] + convKernel[x+1][y+1] ... etc image.save();
Or I will need to use external libraries? In the documentation I've only found that I can change RGB of pixels and no more. How do you handle pixels in your apps?
-
the QImage class has a pixel(x,y) and setPixel(x,y,value) methods
QImage::setPixel()
you can also use QImage::bits()