overlay with a mask image
Show older comments
Hello, I have the following code which shows an image called "zero", I would like just to overlay a mask image (only 0 and 1 values) of the same dimensions so that 0 values are transparent (and then we can see the values of the "zero" image) and 1 values are shown in black. I would like to do this by changing the code already written the less possible. What could I do? Thank you for your help
hFig = figure(1);
set(hFig, 'Position', [11 11 27 7.5]);
set( gca, 'Units', 'normalized', 'Position', [0.05 0.05 0.93 1.2] );
set(0,'defaultFigureUnits','centimeters');
m_proj('equidistant cylindrical','longitudes',[-15 21],'latitudes',[11.5 18]);
m_gridF('ytick',4,'tickdir','out','ticklen',0.005,'linestyle','none');
hold; Plat=18-[0:13]*0.5;
Plon=-15+[0:72]*0.5;
[Plg,Plt]=meshgrid(Plon,Plat);
m_pcolor(Plg,Plt,zero);shading flat;
hold on;
polarmap(flipud(polarmap),0)
M=m_shaperead('clip');
for k=1:length(M.ncst),
m_line(M.ncst{k}(:,1),M.ncst{k}(:,2),'color','k');
end;
hold;
h=colorbar('SouthOutside');
set(h, 'Position', [0.13 .1 .78 .05]);
set(get(h,'title'),'string','test','fontsize',14)
hold;
Answers (1)
Image Analyst
on 26 Jun 2014
0 votes
2 Comments
Image Analyst
on 29 Jun 2014
Jose's "Answer" moved here:
Thank you for your answer. The link you sent me seems to be broken. I have already researched for solutions in internent but I have not found any solution using a similar code. It is maybe a problem difficult to solve using the m_pcolor function of the m_map package.
Image Analyst
on 29 Jun 2014
Seems like a temporary glitch in their web site. It should be working now. You can also look at Brett's version: http://www.mathworks.com/matlabcentral/fileexchange/22108-showmaskasoverlay
Categories
Find more on Programming in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!