How to change the max pixel value of the image
Show older comments
Hello everyone i hope you are doing well.
I have the following image in which white pixel value exist 35,40,45,55
- I want to find the maximum index for example in above 55 is the maximum index then add 50 pixel in to to make new maximum value to 105
- Then i want to divided the each pixel value with the maximum value(105). Then map the value to 10000 e.g multiple new pixel value with 10000 so it will map between 1 to 10000
How can i do it in matlab
3 Comments
Walter Roberson
on 11 Aug 2022
?? Your mask is logical, not an image ??
Your mask is a 2D array, so when you talk about "maximum index" you need to be clear as to whether you mean linear indexing or something else.
But you are adding 50 to an index and using that to divide a pixel value ??
Your mask is 10000 x 1000. Does the "map between 1 to 10000" have to do with the maximum row number being 10000 ?
I am somewhat confused about what you are doing.
Med Future
on 11 Aug 2022
Rena Berman
on 23 Aug 2022
(Answers Dev) Restored edit
Answers (1)
Benjamin Thompson
on 11 Aug 2022
0 votes
This is to increase the values of specific values in a matrix. You can probably take it from there:
>>
>> A = [35 40 45 55; 35 35 55 35; 40 40 40 40]
A =
35 40 45 55
35 35 55 35
40 40 40 40
>> Ireplace = A == 55
Ireplace =
3×4 logical array
0 0 0 1
0 0 1 0
0 0 0 0
>> A(Ireplace) = 55 + 50
A =
35 40 45 105
35 35 105 35
40 40 40 40
1 Comment
Med Future
on 12 Aug 2022
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!