人像图像分割算法_如何旋转人像图像风景

人像图像分割算法

人像图像分割算法

It’s really annoying when you have a great photo that you want to use for something—say, your Facebook Cover Photo—but it’s the wrong aspect ratio. If you can’t take the photo again, your only hope is to use Photoshop (or any other good image editor) to try and fix things.

当您有一张很棒的照片要用于某些东西(例如您的Facebook封面照片)时,这确实很烦人,但这是错误的长宽比。 如果您无法再次拍摄照片,则唯一的希望就是使用Photoshop(或其他任何好的图像编辑器 )尝试修复问题。

Let’s look at my favorite technique to do it. This trick is quick and easy, but it’s not perfect. It works best where the background is reasonably plain or abstract. If there’s anything too complex or recognizable in the background, then this technique will cause more problems than are easily fixable. It also won’t work if the subject is cut off by the edges of the image.

让我们看看我最喜欢的技术。 这个技巧既快速又简单,但并不完美。 在背景相当纯净或抽象的情况下,效果最佳。 如果背景中有太复杂或无法识别的东西,那么此技术将导致比容易解决的问题更多的问题。 如果拍摄对象被图像边缘割断,也将不起作用。

We’re going to take this portrait image from the dance troupe H.E.L.L’s show, the others are hell also, and turn it into a landscape image, since it has a relatively plain back and grey background.

我们将从舞蹈团HELL的表演中获取此肖像图像, 其他人也一样 ,并将其转换为风景图像,因为它具有相对普通的背部和灰色背景。

As always, the more familiar you are with Photoshop’s tools, the easier you will find this article to follow along. If you haven’t checked out our article on Photoshop Layers, you should do so before continuing. We also have an eight part guide to Photoshop for beginners.

与往常一样,您对Photoshop的工具越熟悉,就越容易找到本文。 如果您尚未签出有关Photoshop Layers的文章,则应在继续之前进行。 我们还为初学者提供了Photoshop八部分指南

第一步:重新裁剪图像 (Step One: Re-Crop the Image)

Open the image you’re using in Photoshop. The first thing you’ll want to do is to re-crop it so it’s in the right aspect ratio. This is also the time to straighten the image if it’s crooked like this one is.

在Photoshop中打开您正在使用的图像。 您要做的第一件事是将其重新裁剪为正确的宽高比。 如果图像像这样弯曲,这也是拉直图像的时间。

Grab the Crop Tool from the Tool Bar or press C on your keyboard. If you haven’t used it before, check out our in-depth article on it.

从工具栏上获取裁剪工具,或按键盘上的C。 如果您以前从未使用过它,请查看有关它的深入文章

In the Options Bar, enter the ratio 3:2. Make sure the 3 comes first otherwise you’ll end up with a portrait crop.

在选项栏中,输入比例3:2。 确保以3为首,否则最终会出现人像裁剪。

By default, Photoshop will keep the crop area confined to your image like it is below.

默认情况下,Photoshop会将裁剪区域限制在您的图像范围内,如下图所示。

To extend it, all you need to do is grab one of the handles on the side and drag it out past the edge of the image.

要扩展它,您需要做的就是抓住侧面的手柄之一并将其拖出图像边缘。

Adjust the crop by clicking any where inside the crop area and dragging so that the image is roughly centered.

单击裁剪区域内的任何位置并拖动以调整图像,以使图像大致居中。

Make any other adjustments to the crop you want, like straightening the image as I’ve done.

对您想要的裁剪进行其他任何调整,例如像我一样拉直图像。

When you’ve got everything looking good, press Enter.

当一切看起来都很好时,请按Enter。

第二步:扩展背景 (Step Two: Extend the Background)

Now that the Photoshop document is ready, it’s time to get down to the actual work of expanding the background.

现在,Photoshop文档已准备就绪,是时候开始进行实际的背景扩展工作了。

Select the Rectangular Marquee Tool from the Tool Bar or use the keyboard shortcut M. If you see the Elliptical Marquee Tool instead, press Shift-M to cycle to the Rectangular Marquee Tool.

从工具栏中选择“矩形选框工具”,或使用键盘快捷键M。如果看到的是“椭圆选框工具”,请按Shift-M切换到“矩形选框工具”。

Use the Rectangular Marquee Tool to select the side of the background of the image. Be careful not to accidentally select any of the subjects of the photo.

使用矩形选框工具选择图像背景的一面。 注意不要意外选择照片的任何主题。

We need to duplicate the selection to a new layer so go to Layer > New > Layer via Copy or just press the keyboard shortcut Control+J (Command+J on a Mac).

我们需要将所选内容复制到新图层,因此转到“图层”>“新建”>“通过复制图层”,或仅按键盘快捷键Control + J(在Mac上为Command + J)。

Now we have the pixels we’re going to use to extend the image on a new layer, it’s time to transform them. Go to Edit > Free Transform or use the keyboard shortcut Control+T (Command+T on a Mac).

现在我们有了将用于在新图层上扩展图像的像素,是时候对其进行转换了。 转到“编辑”>“自由变换”,或使用键盘快捷键Control + T(在Mac上为Command + T)。

Grab the handle on the edge farthest from the image and drag it so that the background extends to cover the blank area.

抓住距图像最远的边缘上的手柄并将其拖动,以使背景延伸到覆盖空白区域。

Press Enter or Return and the background is now extended on one side.

按Enter或Return键,背景现在在一侧延伸。

Repeat the procedure for the other edge of the image. Grab the Rectangular Marquee Tool, select a good area of the image, duplicate it to a new layer and transform it so it fills the canvas.

对图像的另一边缘重复该步骤。 抓住矩形选框工具,选择图像的适当区域,将其复制到新图层并进行变换,以使其填充画布。

第三步:解决所有问题 (Step Three: Fix Any Issues)

Sometimes you’ll get lucky and your image will now look great. Often though, there will be some weird looking bits on the transformed area. For example, you can see that a bit of the floor in the image I’m using has become stretched.

有时候,您会很幸运,您的形象现在看起来不错。 但是,经常会在转换后的区域上出现一些奇怪的外观。 例如,您可以看到我正在使用的图像中的地板有些拉长。

The next step is to use Photoshop’s other tools to go in and fix these issues. We’ve covered how to use the healing tools and the clone tools to remove problems in lots of detail before.

下一步是使用Photoshop的其他工具来解决这些问题。 之前,我们已经详细介绍了如何使用修复工具克隆工具消除问题

Assess your image and decide what will work best for it. I’ve used the Healing Brush to quickly get rid of the stretched area.

评估您的形象,并确定最适合的形象。 我已经使用修复刷来快速摆脱拉伸区域。

第四步:添加纹理 (Step Four: Add Texture)

The final step is to add a layer of texture to the whole image. By stretching pixels to fill the background, any of the texture that was already there will be smoothed out.

最后一步是在整个图像上添加一层纹理。 通过拉伸像素以填充背景,可以平滑任何已经存在的纹理。

Create a new layer by going to Layer > New > Layer or use the keyboard shortcut Control+Shift+N (Command+Shift+N on a Mac).

转到图层>新建>图层,或使用键盘快捷键Control + Shift + N(在Mac上为Command + Shift + N)来创建新图层。

Next, use the keyboard shortcut Control+Shift+Alt+E (Command+Shift+Option+E on a Mac) to merge everything onto that new layer.

接下来,使用键盘快捷键Control + Shift + Alt + E(在Mac上为Command + Shift + Option + E)将所有内容合并到该新层上。

Go to Filter > Noise > Add Noise… to bring up the Add Noise dialogue box.

转到“过滤器”>“噪声”>“添加噪声...”,弹出“添加噪声”对话框。

This adds some random texture to the whole image. Make sure Gaussian and Monochromatic are both selected. For the Amount, enter in a value that works for your image. I’ve gone with 2%.

这会在整个图像上添加一些随机纹理。 确保同时选择了高斯和单色。 对于“数量”,输入一个适合您的图像的值。 我已经用了2%。

Let’s look at before after close up at 100%.

让我们先看看收盘后的100%。

The floor looks so much better with the texture applied. And with that, we’re done. Here’s the finished image.

地板在使用纹理的情况下看起来更好。 至此,我们就完成了。 这是完成的图像。



Again, this won’t work for every image, but you might be surprised by how many images it will work for. If you want to change the aspect ratio of an image, give this technique a try. Even if it doesn’t work, it only takes a few moments.

同样,这并不适用于所有图像,但是您可能会对它适用于多少图像感到惊讶。 如果要更改图像的纵横比,请尝试使用此技术。 即使不起作用,也只需要几分钟。

翻译自: https://www.howtogeek.com/295147/how-to-turn-a-portrait-image-landscape/

人像图像分割算法