poster
2019-12-10, 20:48
我想编写一个程序,可以从给定的图片文件夹中创建随机拼贴。
首先,我想用三个图像创建一个简单的拼贴。像这样:
https://i.imgur.com/I5AHe.png
我现在几乎没有代码
clc; clear all; close all; a = imread('a.png'); b = imread('b.png'); c = imread('c.png'); % create a new image of size X x Y % for a simple collage % place a in the top half % place b in the bottom left % place c in the bottom right 如何在MATLAB中完成?
如何拉伸 , 旋转然后将单个图像放置在画布上,以便在创建拼贴画时可以完全自由?可能会发生图像放置,以致图像位于画布区域之外。
https://i.imgur.com/JrrpZ.png
将图像拉伸成表格是拼贴的一种方法,但是我希望能够拉伸并放置它们
回答:
假设您想将图像拉伸成一定形状,并且拥有图像处理工具箱,则可以使用IMRESIZE (http://www.mathworks.com/access/helpdesk/help/toolbox/images/imresize.html)通过以下方式进行拼贴 (http://www.mathworks.com/access/helpdesk/help/toolbox/images/imresize.html) :
创建一个保存为.m文件的函数。这比调用全部清除/全部关闭安全得多。
function collImg = collage %#COLLIMG creates a collage of three images called 'a.png' 'b.png' and 'c.png' %# %# OUTPUT collImg : collage image, with individual images arranged as [a;b,c] %# a = imread('a.png'); b = imread('b.png'); c = imread('c.png'); newImageSize = [512,512]; %# or anything else that is even %# get the new sizes - this approach requires even image size newSizeA = newImageSize./[2,1]; newSizeB = newImageSize./[2,2]; newSizeC = newImageSize./[2,2]; %# resize the images and stick together %# place a in the top half %# place b in the bottom left %# place c in the bottom right collImg = [imresize(a,newSizeA);imresize(b,newSizeB),imresize(c,newSizeC)]; %# display the image figure,imshow(collImg)
更多&回答... (https://stackoverflow.com/questions/3487412)
首先,我想用三个图像创建一个简单的拼贴。像这样:
https://i.imgur.com/I5AHe.png
我现在几乎没有代码
clc; clear all; close all; a = imread('a.png'); b = imread('b.png'); c = imread('c.png'); % create a new image of size X x Y % for a simple collage % place a in the top half % place b in the bottom left % place c in the bottom right 如何在MATLAB中完成?
如何拉伸 , 旋转然后将单个图像放置在画布上,以便在创建拼贴画时可以完全自由?可能会发生图像放置,以致图像位于画布区域之外。
https://i.imgur.com/JrrpZ.png
将图像拉伸成表格是拼贴的一种方法,但是我希望能够拉伸并放置它们
回答:
假设您想将图像拉伸成一定形状,并且拥有图像处理工具箱,则可以使用IMRESIZE (http://www.mathworks.com/access/helpdesk/help/toolbox/images/imresize.html)通过以下方式进行拼贴 (http://www.mathworks.com/access/helpdesk/help/toolbox/images/imresize.html) :
创建一个保存为.m文件的函数。这比调用全部清除/全部关闭安全得多。
function collImg = collage %#COLLIMG creates a collage of three images called 'a.png' 'b.png' and 'c.png' %# %# OUTPUT collImg : collage image, with individual images arranged as [a;b,c] %# a = imread('a.png'); b = imread('b.png'); c = imread('c.png'); newImageSize = [512,512]; %# or anything else that is even %# get the new sizes - this approach requires even image size newSizeA = newImageSize./[2,1]; newSizeB = newImageSize./[2,2]; newSizeC = newImageSize./[2,2]; %# resize the images and stick together %# place a in the top half %# place b in the bottom left %# place c in the bottom right collImg = [imresize(a,newSizeA);imresize(b,newSizeB),imresize(c,newSizeC)]; %# display the image figure,imshow(collImg)
更多&回答... (https://stackoverflow.com/questions/3487412)