[Scilab-users] Auto adjust level of a color image

P M p.muehlmann at gmail.com
Wed Jun 10 09:40:20 CEST 2020


Dear Mat,

not sure if this helps,
but here is a way, how to set brightness using a constant value.

I guess for automatization one can figure out a way using mean pixel value.

Best Regards,
Philipp

img = imread(fullpath(getIPCVpath() + "/images/" + 'baboon.png'));

 // image size = 512 x 512
// result of "imread" is of type 10 --> text object// (???)..guess:
type = unsigned char, which is 8 bit//// However this limits the pixel
values between 0 and 255// e.g.: 255 + 1 will be set to "0"//// for
brightness control we must be able to exceed 255.// ..we also want to
go into negative pixel values// so we need to change integer
type...use int16// positive pixel values above 255 will be set to 255
afterwards// negative pixel values will be set to 0 afterwards
nPx = 512*512;
brighnessLv_1 = 128;brighnessLv_2 = -128;
img_1 = int16(img); img_1 = img_1 + brighnessLv_1;
   img_2 = int16(img);img_2 = img_2 + brighnessLv_2;
pos = find(img_1 > 255);img_1(pos) = 255;pos = find(img_1 < 0);img_1(pos) = 0;
pos = find(img_2 > 255);img_2(pos) = 255;pos = find(img_2 < 0);img_2(pos) = 0;
img_1 = uint8(img_1);img_2 = uint8(img_2);
f = figure();f.figure_size = [1591,610];f.background =
8;subplot(1,3,1);imshow(img);
subplot(1,3,2);imshow(img_1);
subplot(1,3,3);imshow(img_2);




Am Di., 9. Juni 2020 um 22:05 Uhr schrieb mat368 <matthieu.gazon at orange.fr>:

> Hello
> I am looking for a function or a code to auto adjust level of color image ?
> I dont see that in thé ipcv package.
>
> Thanks for tour trop.
> Mat
>
>
>
> --
> Sent from:
> http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200610/27e02904/attachment.htm>


More information about the users mailing list