Showing posts with label advance. Show all posts
Showing posts with label advance. Show all posts

Monday, January 2, 2023

Backup and Restore in C# Windows Form Application

Read Also:  


Programming SeekerzZ

To create backup of database from C# application and then restore it again from C# application follow the steps.
First design a form like bellow:
Form Design for Backup and Restore


Browse Button of Backup Option:

FolderBrowserDialog dlg=new FolderBrowserDialog();
            if(dlg.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = dlg.SelectedPath;

            }


Backup Button Code:

string databse = con.Database.ToString();
            try
            {
                if (textBox1.Text == string.Empty)
                {
                    MessageBox.Show("Please Enter by Browseing Database Backup Location....!");
                }else
                {
                    string cmd = "BACKUP DATABASE [" + databse + "] TO DISK='" + textBox1.Text + "\\" + "database" + "-" + DateTime.Now.ToString("yyyy-MM-dd--HH-mm-ss") + ".bak'";
                    using(SqlCommand command = new SqlCommand(cmd, con))
                    {
                        if(con.State != ConnectionState.Open)
                        {
                            con.Open();

                        }
                        command.ExecuteNonQuery();
                        con.Close();
                        MessageBox.Show("Databse Backup has been Successefully Created..!");

                    }
                }
            }catch(Exception ex)
            {
                MessageBox.Show("Error\n\n" + ex);

            }



Restore button Browse code:

OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "SQL SERVER database backup files|*.bak";
            dlg.Title = "Database restore";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                textBox2.Text = dlg.FileName;

            }



Restore Button Code:

try
            {
                string database = con.Database.ToString();
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                try
                {
                    string sqlStmt2 = string.Format("ALTER DATABASE [" + database + "] SET SINGLE_USER WITH ROLLBACK IMMEDIATE");
                    SqlCommand bu2 = new SqlCommand(sqlStmt2, con);
                    bu2.ExecuteNonQuery();

                    string sqlStmt3 = "USE MASTER RESTORE DATABASE [" + database + "] FROM DISK='" + textBox2.Text + "'WITH REPLACE;";
                    SqlCommand bu3 = new SqlCommand(sqlStmt3, con);
                    bu3.ExecuteNonQuery();

                    string sqlStmt4 = string.Format("ALTER DATABASE [" + database + "] SET MULTI_USER");
                    SqlCommand bu4 = new SqlCommand(sqlStmt4, con);
                    bu4.ExecuteNonQuery();

                    MessageBox.Show("Database Restoration Done Successefully");
                    con.Close();

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }

            }catch(Exception ex) { }





If you are facing any problem in that program contact me with your issue :
https://www.facebook.com/usman.siddique.7771

Thursday, December 22, 2022

Fore Ground Extraction and Back ground subtraction from video in Matlab




Gait recognition project Dataset

As i'm currently working on biometric gait recognition project so to complete that project i have to background subtraction to extract foreground from video.

i'm using CASIA data set videos for my experiments.
So background subtraction is the first thing to do in my project so when we have extracted human structure from video we easily perform our algorithms on it to identify its gait.


Matlab code for background subtraction using frame difference:

clc;              % clear command window
clear all;     % clear work space

% Reading video from computer directory
videoObject = VideoReader('001-bg-01-090.avi');

% Determine how many frames there are.
numberOfFrames = videoObject.NumberOfFrames;

% Loop through all frames
for frame = 1 : numberOfFrames

% Extract the frame from the movie structure.

img1 = read(videoObject, frame);
        img2 = read(videoObject, frame+10);

% In above we take two frame to subtract them from each other

% Subtract frames from each other
img3 =  imsubtract(img1,img2);

% Convert the subtracted result to rgb
  img4 = rgb2gray(img3);

% Apply sobel edge detection on rbg frame
  img5 = edge(img4,'Sobel');

% Use morphological approach to fill holes

d =  bwmorph(ege,'remove',1);
 e = imfill(d,'holes');

% And now save them one by one in hard-disk
        outputFolder = '\newdataset\chknew1';
       
       FileName = sprintf('img%.2d.png', frame);

outputFileName = fullfile(outputFolder, FileName);

imwrite(e, outputFileName, 'png');
        
        end


Saturday, December 17, 2016

Real Time Video Surveillance via Bio Metric Gait Recognition

Real Time Video Surveillance via Bio Metric Gait Recognition  

What is Bio-Metric?

"Bio-metric" comes from the Greek words.
‘Bio’ means ‘life’ and ‘metric’ means ‘to measure’.

Types of Bio-metrics:

There are two types of bio-metrics: Behavioral and Physical.  Behavioral: Voice recognition, keystroke, gait recognition (manner of walking), signature.  Physical: Fingerprint, retina, hand, face. Other bio-metric techniques, still in exploratory stages would include DNA bio-metrics, ear shape, fingernails or odor. 
Real Time Video Surveillance via Bio Metric Gait Recognition  

What is Gait Recognition?

 Gait recognition is recognizing people based on the way they walk. The interest in gait as a bio-metric is strongly motivated by the need for an automated recognition system for visual surveillance and monitoring applications. 

Real Time Video Surveillance via Bio Metric Gait Recognition  

Why Gait Recognition?

People often feel that they can identify a familiar person from afar simply by recognizing the way the person walks. This common experience, combined with recent interest bio-metrics, has led to the development of gait recognition as a form of bio-metric identification
Real Time Video Surveillance via Bio Metric Gait Recognition  


BIO-METRIC GAIT RECOGNITION APPROACHES:

·         MACHINE VISION
·         FLOOR SENSOR  
·         WEARABLE SENSOR  
Real Time Video Surveillance via Bio Metric Gait Recognition  


Gait and Gait Recognition:

 We define gait to be the coordinated, cyclic combination of movements that result in human locomotion. The movements are coordinated in the sense that they must occur with a specific temporal pattern for the gait to occur. The movements in a gait repeat as a walker cycles between steps with alternating feet. It is both the coordinated and cyclic nature of the motion that makes gait a unique phenomenon.

What We Do:

As my final year project is real time video Surveillance via Bio Metric Gait Recognition. I do research on that topic and on the end using Matlab 16 i will create an algorithm using existing algorithms which can identify a person by the way he walk.

As we know every person has his unique style of walking and the pattern of walking he repeat will help us to find the difference between two persons.

By using real time of offline video we have to identify a person which was not in our data base.

Usage:

This system helps us in many ways like 
Attendance
Security purposes



 
Real Time Video Surveillance via Bio Metric Gait Recognition  

Real Time Video Surveillance via Bio Metric Gait Recognition  


Blogger : Hafiz Muhammad Usman Siddique
University : Comsats Wah Campus, Pakistan
Project: Real Time Video Surveillance via Bio Metric Gait Recognition
Email: m7u786@gmail.com
Mob: 03075230948