A
A
aeaeae12022-04-20 21:01:08
C++ / C#
aeaeae1, 2022-04-20 21:01:08

How can I highlight areas of different colors in an image or on a camera?

Good day. I need to make a program that will select color areas of different colors. As in the fact sheet below. In most examples, they write how to find one color.
I found a code that converts to RGB

private void btnLoadSequence_Click(object sender, EventArgs e)
        {
            string dir = Directory.GetParent(Environment.CurrentDirectory).FullName;
            dir = Directory.GetParent(dir).FullName;
            this.openFileDialog1.InitialDirectory = dir;
            
            this.openFileDialog1.Filter="IMAGES |*.jpg;*.bmp";
            this.openFileDialog1.FileName = "";
 
            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                picPreview.Image = null;
                picPreview.Refresh();
                lblInfo.Text = "";
 
                Image b = Image.FromFile(openFileDialog1.FileName);
                picPreview.Image = b;
 
                picProcessed.Image = null;
                picProcessed.Refresh();
            }            
        }
               
        private void btnTrack_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                _kMeans = new KMeans((Bitmap)picPreview.Image, Convert.ToInt32(txtNumClusters.Text), ImageProcessor.Colour.Types.RGB);
            else
                _kMeans = new KMeans((Bitmap)picPreview.Image, Convert.ToInt32(txtNumClusters.Text), ImageProcessor.Colour.Types.HSV);
            
            timer1.Enabled = true;
            timer1.Start();
        }
        #endregion
 
        KMeans _kMeans;
        int _count = 0;

And how do you make it so that you can select individual sections.
62604a30b3e5c167821811.gif
62604a3bc0e9b697728752.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
calculator212, 2022-04-20
@calculator212

it?
or that

In most examples, they write how to find one color.

Well, look not for one color, but several, what's the problem?

H
HemulGM, 2022-04-21
@HemulGM

You just need to use a strong tolerance

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question