Professional Documents
Culture Documents
net c# Introduction
A computer user can be any one paprgrammer or non programmer .so I decided to make a software which include most of the daily task of our computuing life . after the deail servay of computer users(4rnds and family) I found that most of the people read pdf files,use social networks(sharing pictures) edit photos. The idea is to provide a unified solution of many problems. I call it unified software suit .
Libraries: (1) Emgu CV is a cross platform .Net wrapper to the OpenCV image processing library.
Allowing OpenCV functions to be called from .NET compatible languages such as C#, VB, VC++,
IronPython etc. The wrapper can be compiled in Mono and run on Windows, Linux, Mac OS X, iPhone, iPad and Android devices.
In this solution you need this library hardly. All of the software depends upon these libraries.
step 1
add libraries
using Emgu.CV; using Emgu.CV.Structure; using Emgu.Util; in event of the camera button(on/off) private void btnStart_Click(object sender, EventArgs e) {
// you need to check if its initialzed or not if not then initialize it #region if capture is not created, create it now if (capture == null) { try { capture = new Capture(0);// 0 is default video device } catch (Exception excpt) { MessageBox.Show(excpt.Message); } } #endregion
if (capture != null) { if (captureInProgress) { //if camera is getting frames then stop the capture and set button Text // "Start" for resuming capture btnStart.Text = "Start!"; // Application.Idle -= ProcessFrame;
} else { //if camera is NOT getting frames then start the capture and set button // Text to "Stop" for pausing capture btnStart.Text = "Stop"; btnStart.BackColor = Color.Red; Application.Idle += ProcessFrame; } captureInProgress = !captureInProgress; }
Step 2 Now we want to add multiple special effects in picture boxes we have added 6 picture box
try { Image<Bgr, Byte> frame = capture.QueryFrame(); //capture image frame // its a wrapper of ipllimage of open cv bgr stand for blue green red . its a 8bit //image Adding image color effects Image<Gray, Byte> grayFrame = frame.Convert<Gray, Byte>(); Image<Gray, Byte> smallGrayFrame = grayFrame.PyrDown(); Image<Gray, Byte> smoothedGrayFrame = smallGrayFrame.PyrUp(); Image<Gray, Byte> cannyFrame = smoothedGrayFrame.Canny(new Gray(80), new Gray(40)); Image<Gray, Byte> blurr = cannyFrame.SmoothBlur(10, 20); Image<Gray, Byte> xtra = grayFrame.SmoothBilatral(11, 12, 33);
Introduction : Uploading files via a desktop application in just one click. Here it is . He idea is to provide a interface to uploading pictures pictures from desktop Add library
using Facebook; creat a facebook client instance token is the acces token of your facebook profile
note acces token expire after new login . try { FacebookClient fc = new FacebookClient("token"); var parameters = new Dictionary<string, object>
Now select file to upload We convert files into bytes byte[] fileBytes = File.ReadAllBytes(@"" + file); mediaObject.SetValue(fileBytes); IDictionary<string, object> upload = new Dictionary<string, object>(); string tb = textBox1.Text;
upload.Add("name", tb); now facebook client upload photo to photos . photos represent the photos of your facebook account thats it . fc.Post("photos", upload); MessageBox.Show("photos uploaded "); } catch (Exception E) { MessageBox.Show("Uploading failed check your connection!! "); }
Module 3 :
Now for after click event add this code to show the sub directries
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { listView1.Clear(); ImageList img = new ImageList(); Image img1;
Step 2 : Now how I have hard coded the images for the files according to their types . try { String[] dirs = Directory.GetDirectories(treeView1.SelectedNode.Text); String[] dir = Directory.GetFiles(treeView1.SelectedNode.Text); img1 = Image.FromFile("folder.jpg");//0 img.Images.Add(img1); img1 = Image.FromFile("q.jpg");//1 img.Images.Add(img1); img1 = Image.FromFile(@"icon_PDF.png");//2 img.Images.Add( img1);
img1 = Image.FromFile(@"Doc.jpg");//3 img.Images.Add( img1); img1 = Image.FromFile(@"txt.jpg");//4 img.Images.Add(img1); img1 = Image.FromFile(@"ppt.jpg");//5 img.Images.Add( img1); img1 = Image.FromFile(@"rar.jpg");//6 img.Images.Add( img1); img1 = Image.FromFile(@"excel.jpg");//7 img.Images.Add( img1); img1 = Image.FromFile(@"exe.jpg");//8 img.Images.Add( img1); img1 = Image.FromFile(@"vlc.png");//9 img.Images.Add( img1); img1 = Image.FromFile(@"pic.png"); img.Images.Add(img1); int t = 11;
Here I am detecting what kind of files are present if the file is un known then we can give it uknown icon image.
if ((S.Contains(".flv")||S.Contains(".jpg") || S.Contains(".jpeg") || S.Contains(".bmp") || S.Contains(".png") || S.Contains(".pdf") || S.Contains(".doc") || S.Contains(".docx") || S.Contains(".txt") || (S.Contains(".ppt") || S.Contains(".doc") || S.Contains(".docx") || S.Contains(".rar") || S.Contains(".FLV") || S.Contains(".mp3") || S.Contains(".avi") || S.Contains(".mkv") || S.Contains(".mp4") || S.Contains(".exe") || S.Contains(".xlsx") || S.Contains(".zip") || S.Contains(".xls")))) {
Step 3: Get the images from the pictures only . for folder and exe files we have hard coded icons if (S.Contains(".jpg") || S.Contains(".jpeg") || S.Contains(".bmp") || S.Contains(".png")) { Image image = Image.FromFile(@""+S);
listView1.Items.Add(S, 2);
} if (S.Contains(".ppt")) { listView1.Items.Add(S,5 );
} }else{ listView1.Items.Add(S,1); }
} }