uint8 image solarization issue
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Good afternoon I am trying to take a uint8 image and take the complement of all pixels with a grayscale less then 128 and again with all pixels with a grayscale greater than 128. This is an example of my attempt but I don't think it is working properly, if anyone could please give me a hand. I am supposed to create the two functions and then create a small test image to test the functions before applying them to an image but I don't know how to do that.
b=imread('blocks.jpg');
class(b)
comp_light_pixels=b<128 %only complement the lighter pixels of b
subplot(2,2,1)
imshow(comp_light_pixels) %show image with lighter pixels complemented
comp_dark_pixels=b>128 %only complement the darker pixels
subplot(2,2,2)
imshow(comp_dark_pixels) % show image with dark pixels complemented
subplot(2,2,3)
imshow(b) % show original image
subplot(2,2,4)
imshow(255-b) % show completely complemented image
0 comentarios
Respuestas (1)
Walter Roberson
el 25 de Feb. de 2018
comp_light_pixels = b;
mask = comp_light_pixels < 128;
comp_light_pixels(mask) = 255 - comp_light_pixels(mask);
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!