Coloring only specific pixels

前端 未结 2 1380
清歌不尽
清歌不尽 2021-01-24 02:25

I have a matrix representing an image of brain with each (i,j) position having a value between 0 and 1. I am applying a color map, so that those pixels with value 1 are red and

2条回答
  •  轮回少年
    2021-01-24 02:48

    You can do this by plotting a surf(-ace) and passing in alpha values as follows.

    brain = ... % background brain image
    data = ...  % the data you are trying to overlay
    imshow(brain);
    hold on;
    surf(zeros(size(data)), data, 'AlphaData', data > 0.8);
    colormap(...); % whatever colormap you like
    

    Have a look at the surface properties documentation for more options you can pass to surf.

提交回复
热议问题