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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:05:53+00:00 2026-05-13T07:05:53+00:00

I am working on a real estate website and i would like to write

  • 0

I am working on a real estate website and i would like to write a program that
can figure out(classify) if an image is a floor plan or a company logo.

Since i am writing in php i will prefer a php solution but any c++ or opencv solution will be fine as well.

Floor Plan Sample:

alt text http://www.rentingtime.com/uploads/listing/l0050/0000050930/68614.jpg

alt text http://www.rentingtime.com/uploads/listing/l0031/0000031701/44199.jpg

Logo Sample:

alt text http://www.rentingtime.com/uploads/listing/l0091/0000091285/95205.jpg

  • 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-13T07:05:53+00:00Added an answer on May 13, 2026 at 7:05 am

    As always, there is a built-in PHP function for this. Just joking. =)

    All the floor plans I’ve seen they are pretty monochromatic, I think you can play with the number of colors and color saturation to have a pretty good guess is the image is a logo or a floor plan.

    E.g.: is the image has less than 2 or 3 colors is a floor plan.

    E.g.: if the sum / average of the saturation is less than X it's a floor plan.

    Black and white (and other similar colors that are used in floor plans) have a saturation that is zero, or very close to zero, while logos tend to be more visually attractive, hence use more saturated colors.

    Here is a simple function to compute the saturation of a Hex RGB color:

    function Saturation($color)
    {
        $color = array_map('hexdec', str_split($color, 2));
    
        if (max($color) > 0)
        {
            return (max($color) - min($color)) / max($color);
        }
    
        return 0;
    }
    
    var_dump(Saturation('000000')); // black    0.0000000000000000
    var_dump(Saturation('FFFFFF')); // white    0.0000000000000000
    var_dump(Saturation('818185')); // grey     0.0300751879699249
    var_dump(Saturation('5B9058')); // green    0.3888888888888889
    var_dump(Saturation('DE1C5F')); // pink     0.8738738738738738
    var_dump(Saturation('FE7A15')); // orange   0.9173228346456692
    var_dump(Saturation('FF0000')); // red      1.0000000000000000
    var_dump(Saturation('80FF80')); // ---      0.4980392156862745
    var_dump(Saturation('000080')); // ---      1.0000000000000000
    

    Using imagecolorat() and imagecolorsforindex() you can implement a simple function that loops trough all the pixels of the image and sums / computes the average of the saturation. If the image has a saturation level above of a custom threshold you define you can assume that the image is a logo.

    One thing you shouldn’t forget is that images that have a higher resolution will normally have more saturation (more pixels to sum), so for the sake of this algorithm and also for the sake of your server performance it would be wise to resize all the images to a common resolution (say 100×100 or 50×50) to classify them and once classified you could use the original (non-resized) images.

    I made a simple test with the images you provided, here is the code I used:

    $images = array('./44199.jpg', './68614.jpg', './95205.jpg', './logo.png', './logo.gif');
    
    foreach ($images as $image)
    {
        $sat = 0;
        $image = ImageCreateFromString(file_get_contents($image));
    
        for ($x = 0; $x < ImageSX($image); $x++)
        {
            for ($y = 0; $y < ImageSY($image); $y++)
            {
                $color = ImageColorsForIndex($image, ImageColorAt($image, $x, $y));
    
                if (is_array($color) === true)
                {
                    $sat += Saturation(dechex($color['red']) . dechex($color['green']) . dechex($color['blue']));
                }
            }
        }
    
        echo ($sat / (ImageSX($image) * ImageSY($image)));
        echo '<hr />';
    }
    

    And here are the results:

    green floor plant:      0.0151028053
    black floor plant:      0.0000278867
    black and white logo:   0.1245559912
    stackoverflow logo:     0.0399864136
    google logo:            0.1259357324
    

    Using only these examples, I would say the image is a floor plant if the average saturation is less than 0.03 or 0.035, you can tweak it a little further by adding extra examples.

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

Sidebar

Related Questions

Right now I am working on one Real Estate Website, In that website I
I am working on one real estate website which is Using RETS service to
I am working on a program that extracts real time quote for 900+ stocks
I am working in one real-estate website and I have large database around 250
Hi I am currently working on a real estate site. the users on the
I'm working on an application that samples audio and needs to do real time
I'm working on a real estate site and need to make notification mailer: when
I'm working on a real-time website using Nodejs . Currently, I'm using Redis because
I'm working with an MLS real estate listing provider (RETS). Every 48 hours we
I'm working on a PHP Real Estate catalog. I am working on the search

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.