In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to use MATLAB to make a perfect photo wall", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "how to use MATLAB to make a perfect photo wall" this article.
Principle--
In fact, if the previous principle of image segmentation is understood, the principle of stitching pictures in this issue is needless to say.
Isn't the photo wall a big picture made up of many small pictures, that is to say, the photo wall is actually a large matrix made up of many small matrices. It suddenly became clear that it could be achieved by stitching these matrices together with a loop. (however, it is worth noting that they are usually rgb images, and if they are stitched in the original size, the matrix will be too large and the MATLAB will simply quit, so if there are many images, you need to use the imresize function to reduce it.)
-source code--
Clc
Clear
Close all
Warning off
%% I moved the folder temp where the pictures were saved to the current path, there are 16 pictures in it
Pics = struct2cell (dir ('temp\ * jpg'));% read pictures in the folder
Pics = Pics (1dint:);% get picture name
OnePic = imread (['temp\' Pics {1}]);% read the first picture
OnePic = imresize (OnePic,0.5);% the original image is relatively large, but after being combined into a photo wall, the photo wall is too large, so zoom out a bit.
M = size (OnePic,1);% gets the number of pixel lines of the first picture
N = size (OnePic,2);% get the number of pixel columns of the first picture
There are 16 pictures in temp
% Photo Wall set to 4x4 here
Row = 4% 4 lines
Column = 4% 4 columns
FullPic = uint8 (zeros (mendrowMagol 3));% initialize the photo wall
K = 1% initialize the counter to record the number of pictures
For I = 0:row-1
For j = 0:column-1
I_Temp = imread (['temp\', Pics {k}]);% read into photos
I_Temp = imresize (I_Temp, [MJI n]);% set all photos to the size of the first photo
FullPic (i*m+1: (iTun1) * m, j*n+1: (juni1) * n,:) = Itembox% stitching
K = kumb1bot% update counter
Imshow (fullPic)% displays the current photo wall
Drawnow% refreshes the screen
End
End
Imwrite (fullPic,'PicWall.jpg')% Save Picture
Since we want to save multiple pictures before, we use a four-dimensional array, and the fourth dimension is the number of photos. And here, we just need to save a picture, so we can save it in a three-dimensional array.
-- partial usage of imresize function--
Here I'd better paste the contents of help directly so that we can learn English together.
Imresize: Resize image.
B = imresize (A, SCALE) returns an image that is SCALE times the
Size of A, which is a grayscale, RGB, or binary image.
B = imresize (A, [NUMROWS NUMCOLS]) resizes the image so that it has the specified number of rows and columns. Either NUMROWS or NUMCOLS may be NaN, in which case imresize computes the number of rows or columns automatically in order to preserve the image aspect ratio.
Explain: in the first usage, SCALE is the multiple of magnifying the image matrix A, such as reducing it by 0.5 times and writing it by 0.5 times.
The second usage is that [NUMROWS NUMCOLS] puts the picture after resize with NUMROWS row pixels and NUMCOLS column pixels.
The first method is used in the program.
-effect--
My computer is a bit stuck, so the GIF below is a little slow at the beginning. (mainly because the matrix of the photo wall is a little large.)
The above is all the contents of the article "how to make a perfect Photo Wall with MATLAB". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.