✅ Process image using Emgu.CV, WPF app .NET 7.0
So i have to check if the image i upload is in Grayscale or not and based on it make further progress
here is how i upload image:
and here is how i try to convert it but no matter if i upload gray image or not it says the image is already in grayscale, (i checked using ImageJ)
here is how i upload image:
private void BtnOpenNewFile_Click(object sender, RoutedEventArgs e)
{
var openFileDialog = new OpenFileDialog
{
Filter = "Image Files (*.bmp;*.jpg;*.jpeg;*.gif;*.png)|*.bmp;*.jpg;*.jpeg;*.gif;*.png"
};
if (openFileDialog.ShowDialog() == true)
{
Mat image = new Mat(openFileDialog.FileName, ImreadModes.Color);
string fileName = Path.GetFileNameWithoutExtension(openFileDialog.FileName);
ImageWindow imageWindow = new ImageWindow();
if (image.Height > 1000 || image.Width > 1000)
{
imageWindow.Height = 1000;
imageWindow.Width = 1000;
}
else
{
imageWindow.Height = image.Height + 200;
imageWindow.Width = image.Width + 50;
}
imageWindow.Title = fileName;
imageWindow.ImgMainImage.Source = image.ToBitmapSource();
imageWindow.Show();
}
} private void BtnOpenNewFile_Click(object sender, RoutedEventArgs e)
{
var openFileDialog = new OpenFileDialog
{
Filter = "Image Files (*.bmp;*.jpg;*.jpeg;*.gif;*.png)|*.bmp;*.jpg;*.jpeg;*.gif;*.png"
};
if (openFileDialog.ShowDialog() == true)
{
Mat image = new Mat(openFileDialog.FileName, ImreadModes.Color);
string fileName = Path.GetFileNameWithoutExtension(openFileDialog.FileName);
ImageWindow imageWindow = new ImageWindow();
if (image.Height > 1000 || image.Width > 1000)
{
imageWindow.Height = 1000;
imageWindow.Width = 1000;
}
else
{
imageWindow.Height = image.Height + 200;
imageWindow.Width = image.Width + 50;
}
imageWindow.Title = fileName;
imageWindow.ImgMainImage.Source = image.ToBitmapSource();
imageWindow.Show();
}
}and here is how i try to convert it but no matter if i upload gray image or not it says the image is already in grayscale, (i checked using ImageJ)