How can I color the pixels of my image depending of it's value in an equation?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
For my final degree project I need to color the pixels of an image depending on the final value when using an specific equation.
For instance, for each pixel I have extracted the PA, P1, P2 and P3 values.
Then I use an exponencial equation to calculate one value (probability) of each pixel just like: Prob=1/(1+exp(2.213.*PA+2.358.*P1-1.625.*P2-1.257.*P3+3.128));
Finnally, if the Prob value is higher than 0.351 I want that pixel to be in green while if it's lower in red (for example, the colors don't matter).
If someone know's how to do it would be a great help, thank you in advanced.
댓글 수: 0
답변 (1개)
KSSV
2020년 6월 25일
Let I be your image pixle matrix with the values Prob repalced using the shown formula.
% To repalce values less than Prob
idx = I<Prob ;
I(idx) = val1 ; % your value
idx = I<Prob ;
I(idx) = val2 ; % your value
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!