Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6972637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:59:43+00:00 2026-05-27T16:59:43+00:00

I am trying to solve a problem of compositing two images in Java. The

  • 0

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.

My Tasks:

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.

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.

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.

Note: I cannot use any Java data structure except Arrays (not even ArrayList) or I can use my own defined data structure.

I am new in this area and am trying to solve it. What steps must I follow to solve this problem?

My main issue is, how do I represent the images as graphs in Java code (for instance with arrays or my own data structure)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:59:44+00:00Added an answer on May 27, 2026 at 4:59 pm

    Here is what can be an answer to your “Main issue” part of the question.

    You have to represent the images pixels as graph and also you have a restriction to use Java array only. Well if you look at a 2 dimensional array which you will need to use represent the pixels of the image, it can be used as an graph as well just that each item in the array will only have data value (pixel color) and the attached node to the current node can be calculated using the below formula:

    Current pixel : [X,Y]
    Top pixel : [X,Y-1] 
    Bottom pixel : [X,Y+1]
    Left pixel : [X-1,Y]
    Right pixel : [X+1,Y]
    

    NOTE: X and Y are index in the 2D array. Also, when incrementing/decrementing X or Y to calculate neighbor pixel you need to make sure that you dont’t overflow/underflow the boundary of the image i.e decrementing should not cause the value of X/Y to be < 0 and increment should not cause the X to go beyond width of image and Y to go beyond height of image.

    Refer: http://docs.oracle.com/javase/tutorial/2d/images/index.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to solve a problem with templatetags. I have two templatetags: @register.inclusion_tag('directory/_alphabet.html') def alphabet_list(names):
Trying to solve a problem of preventing duplicate images to be uploaded. I have
I've been trying to solve these problem for last two hours but seems like
I'm trying to solve Problem 41 of project Euler in Java, by counting the
I'm trying to solve a problem using java, iText, and the Java advanced imaging
I am new to Java and trying to solve the problem below So this
I'm learning Sockets programming in Java. I'm trying to solve a problem that consists
I'm trying to solve the problem of the second day but with no success
Trying to solve this problem . I would like to learn how the bootstrapper
I'm trying to solve the problem of passing a 2-dimensional table into JavaScript AJAX

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.