After dividing a 512*512 image into non overlapping two pixel blocks, why can't i perform operations on the pixel values? If i multiply a pixel value (163) with 5, it shows 255 everytime..what could be done to perform operations on the pixel values?

1 次查看(过去 30 天)
After dividing a 512*512 image into non overlapping two pixel blocks, why can't i perform operations on the pixel values?
If i multiply a pixel value (163) with 5, it shows 255 everytime..what could be done to perform operations on the pixel values?

回答(1 个)

Munish Raj
Munish Raj 2019-2-7
It is my understanding that you are not able to perform a multiplication operation (pixel*5) on individual pixels of your blocks. When you multiply your pixel by 5, it shows 255 every time.
This might be because the pixel values in MATLAB vary from 0 – 255 (0 being the minimum and 255 being the maximum).
When you try to modify a pixel to anything above 255, MATLAB will automatically keep the pixel at 255.
If your application requires you to scale a particular pixel by 5 times as compares to the other pixels,
you could scale all pixels down by a factor of 5 and then multiply the required pixel by 5.
I = imread('image_path'); %replace image with your image path e.g.: C://users/documents/1,jpg
I=I/5; %scale down all pixels by 5
%perform your operations here
%
%
%
%all the pixels will be dim, except the pixels you multiply by 5.
Munish Raj

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by