HI I was trying to brighten grayscale image with I=rgb2gray(A) J = imadjust(I) . For some reason it was not working. Can anyone please tell me if there any other way? thanks

1 visualizzazione (ultimi 30 giorni)
I was trying to brighten grayscale image with I=rgb2gray(A) J = imadjust(I) . For some reason it was not working. Can anyone please tell me if there any other way? thanks
  2 Commenti
Jan
Jan il 8 Feb 2016
Please explain "not working" with any details. Do you get an error message or do the results differ from your expectations?
Ashim Chakraborty
Ashim Chakraborty il 8 Feb 2016
basically the output i am looking for is not generating. I meant to brighten up grayscale image.I think imadjust() command upgrade the contrast but will it work to brighten up the image? I dont get any error message. thanks

Accedi per commentare.

Risposta accettata

Stephen23
Stephen23 il 8 Feb 2016
Modificato: Stephen23 il 8 Feb 2016
Actually imadjust can also brighten images, you just need to supply the fourth input gamma:
J = imadjust(I,[],[],gamma);
Where the documentation describes gamma: _"If gamma is less than 1, imadjust weights the mapping toward higher (brighter) output values. If gamma is greater than 1, imadjust weights the mapping toward lower (darker) output values. If you omit the argument, gamma defaults to 1 (linear mapping)"
So try some gamma values until you get one that you like.

Più risposte (1)

Image Analyst
Image Analyst il 8 Feb 2016
How about brighten()?
If not, then just add some offset to your image.
brighterImage = originalImage + someOffset;
  1 Commento
DGM
DGM il 13 Nov 2022
While the webdocs recommend brighten() in the links related to image adjustment, brighten() doesn't work on images. It works on colormaps and graphics objects in a figure. Though not practically convenient, any RGB image could be reshaped to work with it.
Acmap = reshape(im2double(A),[],3); % integer inputs are not supported!
Bcmap = brighten(Acmap,0.5);
B = reshape(im2uint8(Bcmap),size(A));
It's worth noting that contrary to the name, this is not an additive brightness adjustment tool. It's an obfuscated gamma adjustment tool.
in = linspace(0,1,100);
% simple additive "brightness" control
out_additive = min(max(in+0.15,0),1);
% a gamma control with linearized control parameter
out_gamma = brighten(in,0.5);
plot(in,out_additive); hold on
plot(in,out_gamma)
xlabel('input graylevel')
ylabel('output graylevel')
legend('additive','using brighten()','location','southeast')

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by