Showing posts with label OpenFileDialog. Show all posts
Showing posts with label OpenFileDialog. Show all posts

Friday, June 28, 2013

Restricting the Opening File Type in C# in OpenFileDialog

 // Calling the OpenFileDialog           
                  OpenFileDialog Openfile = new OpenFileDialog(); 
// Defining the Allowed File Types
            Openfile.Filter = "Image Files ( *.jpg; *.jpeg)| *.jpg; *.jpeg; "; 

Resizing a Image in ENGU CV

// To get orginal image from the OpenFileDialog
Image<Bgr, Byte> captureImage = new Image<Bgr, byte>(openImageFileDialog.FileName);
// To resize the image 
Image<Bgr, byte> resizedImage = captureImage.Resize(width, height, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR);
/////////////////////OR///////////////////////
//open the image using open file dialog
OpenFileDialog Openfile = new OpenFileDialog();
            if (Openfile.ShowDialog() == DialogResult.OK)
            {
                Image<Bgr, Byte> imgOriginal = new Image<Bgr, byte>(Openfile.FileName); //Open
                Image<Bgr, byte> resizedImage = imgCurrent.Resize(width, height, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR); //Resize
            }

Source : http://stackoverflow.com/questions/15052419/how-to-resize-image-with-imagebox-emgucv