Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
Is there anyway to change images in a imagebox of emgucv using folderbrowser dialog box. I also need to select images from subfolders I tried this:

C#
private void btSelectFolder_Click(object sender, EventArgs e)
{
        FolderBrowserDialog ofd = new FolderBrowserDialog();
        if (ofd.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            try
            {
                textBox7.Text = ofd.SelectedPath;
                image = Directory.GetFiles(ofd.SelectedPath, "*.jpg");
//trying to get all image files
                frame = new Image<Bgr, byte>((Bitmap)Bitmap.image);
// I get error here//this line is to convert image to emguCV image type
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
    }


Plz help asap..thank u in advance...
Posted
Updated 9-Sep-15 2:11am
v4
Comments
Suvabrata Roy 9-Sep-15 8:22am    
Go through this link : http://www.emgu.com/wiki/index.php/Working_with_Images
Kopika 9-Sep-15 9:08am    
thank u.. @suv I have gone through it already.. but dont know how to use it in my folderbrowser code.. please help
Suvabrata Roy 10-Sep-15 0:48am    
please explain what exactly you need to do...
Kopika 10-Sep-15 0:56am    
can i send u the whole code?
Suvabrata Roy 10-Sep-15 0:58am    
Plz...

1 solution

Hi,

Problem 1 :I don't know how to load images from the folders

C#
FolderBrowserDialog fbd = new FolderBrowserDialog();
            DialogResult result = fbd.ShowDialog();
            string[] files = { };
            if (result == System.Windows.Forms.DialogResult.OK)
                files = Directory.GetFiles(fbd.SelectedPath, "*.jpg", SearchOption.AllDirectories);



Problem 2 : I dont know to convert the image

C#
foreach (var file in files)
           {
               Image<bgr, byte> EmguImage = new Image<bgr, byte>(new Bitmap(file));
           }
 
Share this answer
 
Comments
Kopika 10-Sep-15 1:47am    
Thank u so much Mr. Suvabrata.. I didnt get errors.. If I have any further doubts can I ask u?
Suvabrata Roy 10-Sep-15 1:58am    
Sure...
Kopika 10-Sep-15 2:18am    
will the image change automatically after finishing its process?
Suvabrata Roy 10-Sep-15 2:23am    
I did not do that code you change your code as per requirement

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