Adjusting the brightness and contrast of your image in the frequency domain is certainly possible, but the practical implications behind it are questionable. Mainly, I am not sure why you would want to go through all of the computational burden of calculating each DCT block. Contrast and brightness enhancement in this particular case in the spatial domain is of worst case O(n)
where n
is the total number of pixels in the image. Going to the frequency domain will incur additional computational cost.
In any case, as you mentioned in your post, you can increase brightness by adding a constant to all of the intensity values, and to increase contrast you can scale each pixel by a constant factor. It is analogous to the frequency domain like so:
Contrast Enhancement
By taking a look at the spatial domain, if you multiply every pixel by a constant, all of the DCT coefficients will also get multiplied by a constant as well as the DCT is a (relatively) invertible transform. As such, if you want to achieve contrast enhancement, you can take every single value for every DCT block that you have and multiply by this constant.
Brightness Enhancement
By taking a look at the spatial domain, if you take every pixel and add a constant to it, you are essentially increasing the overall "power" of the image. If you were to take a look at the frequency spectrum between any image and an image with a constant value added to each pixel, for the DCT blocks the coefficients would be the same except for the DC value (top left corner of each block). As such, if you wanted to increase brightness in the frequency domain, you would add a constant value to each of the DC values in each of the DCT blocks. However, I am not sure what the numerical correlation is between adding a value to the DC term in each block in comparison to adding a constant value to each pixel in the spatial domain. What I mean to say is adding a value of... let's say... 5 for example... in the spatial domain does not mean that if you add a value of 5 to each of the DC values, you will get the same results. There will definitely be an increase in brightness, but I'm not sure how to quantify how much brightness increase you will get once you take the inverse DCT.
A caveat that you should take a note of is that if you try to add a value to every DCT coefficient, you would essentially be simulating additive white Gaussian noise. The higher the value, the more noise that gets introduced into your image. As such, if you were to take the inverse DCT, the results may not be favourable to your liking. Therefore, make sure you only add a constant to the DC value (i.e. the top left corner of a DCT block)
Long story short, theoretically it is possible to do this in the frequency domain, but practically speaking I don't see a point.