两个图像图像合成 [英] Image compositing of two Images

查看:128
本文介绍了两个图像图像合成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解决合成两个图像在Java中的一个问题。该方案将取所述第一图像的第二图像上的一部分,并且过去它。的目标是使这两个图像之间的边界不太明显。边界必须选择在这样一种方式,在边界处的两个图像之间的差别是小的。

I am trying to solve a problem of compositing two images in Java. The program will take a part of the first image and past it on the second image. The goal is to make the boundary between the two images less visible. The boundary must be chosen in such a way that the difference between the two images at the boundary is small.

我的任务:

要编写一个方法,选择两个图像之间的边界。该方法将接收的输入图像的重叠部分。这必须先被转换,以使边界总是从左上角到右下角

To write a method to choose the boundary between the two images. The method will receive the overlapping parts of the input images. This must first be transformed so that the boundary always starts from the left-top corner to the right-bottom corner.

注意: 返回的图像不应是接合的图像,但给出了用于两个图像的部分

NOTE: The returned image should not be the joined image but gives which parts of the two images were used.

边界线的像素可以打上一个恒定的(SEAM)。第一图像的像素可以打上整数0,与整数1.所述第二图像的像素中选择的边界线后,将此时,floodFill 算法可以用于填充额外像素0或1

The pixels of the boundary line can be marked with a constant(SEAM). Pixels of the first image can be marked with integer 0, pixels of the second image with integer 1. After choosing the boundary line, the floodfill algorithm can be used to fill the extra pixels with 0 or 1.

注意:图片可以重新$ P psented为图形,由此每个像素与它的左,右,上,下​​邻居连接$。因此,使用颜色填充会像深度优先搜索。

NOTE: The image can be represented as a graph whereby each pixel is connected with its left, right, top and bottom neighbor. So using the flood fill will be like depth-first search.

最短路径算法必须被用于选择的边界,以使之小

The shortest path algorithm must be used to choose the boundary in order to make it small.

注意:我不能使用任何Java数据结构,除了阵列(即使不是ArrayList中)

NOTE: I can not use any java data structure except Arrays (not even ArrayList)

大家好,我在这个新的领域,并正在试图解决这个问题。我必须遵循什么措施来解决这个问题?或指向一个教程

Guys, am new in this area and am trying to solve it. What steps must I follow to solve this problem? or a pointer to a tutorial

推荐答案

我会做这样:

选择边框的宽度检查。在你的意志。  1.找到像素的最大可能的转变。这是D.  2.对于在广场上所有可能发生的变化(+ -D,+ - D)的k(相关quocient)为边界。边界被取入移位的中间。  3.具有最大的k是转变是最好的。让我们理所当然它服用。  4.现在开始移动的边界,以K以同样的方式检查它。找到它的位置。完成。

Choose the width of the border checked. At your will. 1. find the maximal possible shift in pixels. That is D. 2. For all possible shifts in the square (+-D,+-D) find the k (correlation quocient) for the border. The border is taken in the middle of the shift. 3. The shift that has the largest k is the best. Let it be taken for granted. 4. Now begin to move the border, checking it by "k" the same way. Find the place of it. Done.

如果D是大并且该过程很长,这样做在2(或更多)的阶段。在第一阶段的计数k是大的步骤,最后阶段为1。也可以使用previous滤波步骤

If D is large and the process is long, do it in 2(or more) stages. On the first stages the step of counting k is large, the last stage has step of 1. You could also use previous filtering.

如果边界或相对图像的位置可以转动时,算法不改变主要是 - 只添加到它尝试了不同的稍微转向的位置,后来名列前茅的k - 打开边境,太。

If the border or relative images' position could be turned, the algorithm doesn't change principally - only add to it trying for the best k among different slightly turned positions and later - turned border, too.

这篇关于两个图像图像合成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆