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

  • Home
  • SEARCH
  • 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 6245335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:29:12+00:00 2026-05-24T12:29:12+00:00

Given a generated histogram that I got from an image I was wondering if

  • 0

Given a generated histogram that I got from an image I was wondering if there was any optimized way to generate a mask. Below I have added in 3 different images: the reference to use, the histogram data of the reference, and the main image that I would like to mask. I know that I could do this by each pixel and vary the color information by a certain percentage so that I would be able to get colors with lighting changes as well.

The basic idea is to find a color, given by the histogram data and within a certain range, and if it finds anything then to make it black. If it doesn’t find anything then the color will be white.

Any advice would be greatly appreciated.

Reference image:

1-UP

Histogram values:

Histogram

Image to mask:

Logo

  • 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-24T12:29:12+00:00Added an answer on May 24, 2026 at 12:29 pm

    What you want is to mask a color in a certain range, this is what you should try with the code i posted here :
    In my example, it is used to make it transparent, if you want to make it black, just skip the cvNot() step…

    Making a color completely transparent in OpenCV

    Hope it helped,
    Julien

    PS : i’ve just seen that you were the one who asked the question I answered about how to make a color transparent: the problem here is exactly the same… just adapt a lil bit the answer..

    • 1) Convert your image RGB -> HSV : cvtColor()
    • 2) Generate your histogram : calcHist()
    • 3) Find the maximum in your Hue histogram : minMaxLoc()
    • 4) Select thresholds around this maximum : your function
    • 5) Use them to select only the color you want : inRange()
    • 6) Put this mask in black : your function (a very simple way would be to remove all the RGB components on the mask) : your function
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used XSD2Code to generate C# code from given XSD. This tool generated code
Given an interface or interfaces, what is the best way to generate an class
So I've got this table being generated and each cell is given a unique
When my application crashed, Windows XP did not generate the window given below I
given a script that generates a string of 12 characters randomly generated, how many
Given a pre-saved generated Gravatar image in high resolution, is it possible to get
I notice that in the generated SWIG wrappers for a given set of classes,
i followed the steps that are given for cobertura report and i generated report
I was given XML files I believe were generated from an oData service endpoint
Given that I know the hashed password, salt & original password generated with Authlogic

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.