Can SQRT be used on an RGB image with double precision?

1 visualización (últimos 30 días)
FJ
FJ el 6 de Abr. de 2018
Comentada: Rik el 6 de Abr. de 2018
I am trying to square root my RGB image but it keeps showing me a white output image.

Respuesta aceptada

Rik
Rik el 6 de Abr. de 2018
That is due to the way you display the image. You probably have a uint8 input with values from 0-255. sqrt then does its thing and computes the square root for each element, and converts it to a double. Then you try to use imshow, but now your image is a double, so imshow assumes your data is scaled from 0-1, instead of 0-255 (or 0-15.9687).
You should read the doc for instructions on how you can specify the range, or just scale the image yourself.
  2 comentarios
FJ
FJ el 6 de Abr. de 2018
Editada: FJ el 6 de Abr. de 2018
Thank you. I'll look into that. So you are saying that once an uint8 is converted into a double (and applied with operations), the values change and I need to scale back to see the original image(with operations applied)?
Rik
Rik el 6 de Abr. de 2018
You could scale the image to 0-1 doubles with the line below before you calculate the root.
I2 = im2double(I);
Then you don't have to worry about imshow, but your absolute values will be a factor sqrt(255) lower.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by