Non-pixelized image using imagesc (or alternatives)
Show older comments
Hello everyone
I have generated an image using imagesc, which looks like this

The problem is that you can see the pixels, and it has no quality enough to show in a scientific meeting. My matrix has 115x85 elements.
Any idea on how to display this image in a much more smooth and clear way?
Hopefully I would obtain a image resolution like this one: https://static-content.springer.com/esm/art%3A10.1038%2Fs41524-022-00864-x/MediaObjects/41524_2022_864_MOESM3_ESM.mp4
I am attaching the relevant data for the plot. With this, I write to plot it:
u1=figure();
imagesc(space_x,space_y,matrix);
axis xy;
colormap(cmap);
box on;
clr1=colorbar('YTickLabel',{'-1','-0.5','0','0.5','1'},'YTick',[-1:0.5:1]);
xlabel('$x$-{\it th} spatial direction, $x \, \, \left( \mathrm{nm} \right)$','FontSize',14,'interpreter','latex');
ylabel('$y$-{\it th} spatial direction, $y \, \, \left( \mathrm{nm} \right)$','FontSize',14,'interpreter','latex');
ylabel(clr1,'$x$-{\it th} magnetization component, $m_x$','Interpreter','Latex','FontSize',14);
caxis([-1 1]);
xlim([0 40]);
ylim([0 40]);
t1=title(['$t=0$ ns, $T=200$ K, $\mathbf{H}=0$'],'FontSize',14,'interpreter','latex');
set(t1,'interpreter','latex','FontSize',14);
set(gca,'TickLabelInterpreter','latex','FontSize',14);
set(u1,'Units','Inches');
posu1=get(u1,'Position');
set(u1,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[posu1(3),posu1(4)]);
cmap is user-defined colormap, it can be changed to other one.
Accepted Answer
More Answers (2)
Bjorn Gustavsson
on 29 Mar 2023
That was not an immage you linked to but rather a movie (at a push a sequence of images). The first frame seemed reasonably similar to your random one. Then there might be any of a number of operations done to the consecutive frames. One thing that might occur is simple linear diffusion (corresponding to convolution with a 2-D Gaussian). For example something like this:
I = randn(128,64); % mock-up of initial frame
fK = [0.125,.25,0.125;0.25 1 0.25;0.125, 0.25 0.125]; % filter-kernel to convolve image with
fK = fK/sum(fK(:)); % normalize it to add to 1
for i1 = 1:200
imagesc(I)
drawnow
I = imfilter(I,fK,'symmetric'); % you could also use plain conv2: I = conv2(I,fK,'same');
end
This is not exactly what is done in the video you linked to but it should be enough to get you going, and from the information given it is "slightly challenging" to do your research job for you...
HTH
2 Comments
Roderick
on 29 Mar 2023
Bjorn Gustavsson
on 29 Mar 2023
The top left frame in fig 2 clearly has larger number of pixels than 128 x 64 - perhaps 1024 x 512 or even 2048 x 1024 - if you simply increase the size of I in my suggestion to that size and then run the exact same diffusion on that image you will pass through a region where I looks rather similar to fig 2a - which you could use as your "initial image".
Image Analyst
on 29 Mar 2023
0 votes
However you created that image, you simply need to create it with more pixels. You can use imresize and then blur it, but it won't be the same and will look blurred. If you want sharp edges, you're just going to have to have more resolution.
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!