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 8169899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:59:44+00:00 2026-06-06T20:59:44+00:00

I get 25 sample pieces from an image, get their average rgb values and

  • 0

I get 25 sample pieces from an image, get their average rgb values and save them in 5×5 Color arrays. These are my “signatures”. Values in signatures are like following:

Color signature[5][5];

-21233 -1 -323211 ... ...
-123 -12323 ...  
...

I can reach red, blue and green values from indexes of the signature. I use these values to compare two images’ signatures and get a “difference” value.

signature[1][1].getBlue() = 123, Color[1][1].getRed() = 200 ..

for (int x = 0; x < 5; x++) {   
        for (int y = 0;y < 5; y++) {
            int r1 = signature[x][y].getRed();
            int g1 = signature[x][y].getGreen();
            int b1 = signature[x][y].getBlue();
            int r2 = signature2[x][y].getRed();
            int g2 = signature2[x][y].getGreen();
            int b2 = signature2[x][y].getBlue();
            double tempDiff =  Math.sqrt((r1 - r2) * (r1 - r2) 
                                       + (g1 - g2) * (g1 - g2) 
                                       + (b1 - b2) * (b1 - b2));
            difference += tempDiff;
        }
 }

I also got a second signature for images, showing their edge-found version’s signatures. Comparing two images, I multiply normal-signature difference with edge-signature difference and get the final difference value.

Everything works great in comparing two images. However, I got lots of images, so I saved my signatures in database like following:

Table images:
-COLUMN name-       -COLUMN signature-             -COLUMN edge signature-
myimg.jpg  |-12312 -132 -2 ... (25 of them) |-123 -1 -1234 -6921 .. (25 of them)|

I simply concatenate signature indexes with spaces between them and save as String.

Here’s my question: I need to find similarities for one image. If I select all images from the database, things get really slow and I’m out of memory. I can select 1000’s of images from database, compare and get the next 1000, but this is even slower.

I need a way to compare the image signatures in the query, I am ready to change my table’s columns, even ready to try insane tables with 100 columns holding all RGB values of the signature. I need reducing or hashing of the signature. It there any ways/approaches, links or libraries can you suggest? Any help would be appreciated.

If needed, I use Java on NetBeans, working with MySQL.

  • 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-06-06T20:59:47+00:00Added an answer on June 6, 2026 at 8:59 pm

    After seeing that we need 150 columns, two approaches came into mind:

    1. Reducing the number of columns according to a logic.
    2. Using perceptual hash (hashing in which close hash values represent close before-hashed values)

    However, after an ugly and messy implementation, the code worked just fine. What I’m doing is simply doing the calculation in the question with an SQL query and getting the most similar 50 pictures from the database. After I got the results I tidied up the code a little bit, and it’s working fine and fast.

    So we saw no real need to implement the approaches above as they reduce the success of finding similarities and we don’t need to be faster. We get the best 50 results, so memory complexity isn’t a problem, too.

    For all those have speed or memory problems in “Java part” (or any other “code” part) in the project, I strongly recommend to transfer as much work as it can get to “Database part” and get the things done with queries.

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

Sidebar

Related Questions

I am trying to put together an XML document from several pieces. To get
I'm using SimpleXML to get pieces of data from an XML web-service response. We
I'm trying to get the sample and other sample codes i find for pyuno
I am learning basics of EJB 3.0. I have managed to get a sample
I'm trying to get a basic sample across domains working, but I just cannot
I want to get 'second' in the following sample web address. http://www.mywebsite.com/first/sedond/third.html first can
I get the following error when I try to run sample example of Google
Is there a sample code available online to get WinRT to determine if its
Trying to get comfortable with jQuery and I have encountered some sample code that
can anyone tell me (code sample woudl be awesome) how to get the the

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.