Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to display a histogram of the picture by using emgucv library but I have a problem with the instruction "Mat", the program gives a message that the 'Mat' do not found...how solve that? and by what I can replace it?

What I have tried:

using Emgu.CV;
using Emgu.CV.Structure;

namespace histogram
{
    public partial class Form1 : Form
    {
        Image<Bgr, byte> imgB;
        Image<Gray, byte> imgG;
        public Form1()
        {
            InitializeComponent();
        }
<pre>private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            if(ofd.ShowDialog()==DialogResult.OK)
            {
                imgB = new Image<Bgr, byte>(ofd .FileName );
                imageBox1.Image = imgB;
                imageBox1.FunctionalMode = Emgu.CV.UI.ImageBox.FunctionalModeOption.Minimum;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            imgG = imgB.Convert<Gray, byte>();
            panAndZoomPictureBox1.Image = imgG.Bitmap;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            DenseHistogram hist = new DenseHistogram(256, new RangeF(0, 255));
            hist.Calculate(new Image<Gray, byte>[] {imgB[0] }, false, null);
            Mat m = new Mat();
            hist.Copy(m);

            histogramBox1.AddHistogram("Blue", Color.Blue, m);
        }
    }
Posted
Updated 1-Apr-19 0:20am
Comments
Patrice T 31-Mar-19 6:40am    
What says documentation ?

This may be useful for you

Mat Class[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900