You are on page 1of 21

Chapter 1

Introduction

Verification of signature is the process of confirming the authenticity of a signature on a


document or message. It is an important security measure that helps to prevent fraud and ensure
the integrity of important transactions .The process of verification typically involves comparing
the signature on the document or message with a known, authentic signature. This can be done
manually by a trained professional, or through the use of technology such as signature recognition
software. In the case of digital signatures, the verification process involves verifying the digital
signature certificate and confirming that it was issued by a trusted certificate authority. The
signature itself is then validated using cryptographic algorithms to ensure that it has not been
tampered with or altered in any way. Overall, the verification of signature is an important aspect
of maintaining trust and security various contexts such as legal agreements, financial transactions,
and electronic communications. Verification of signature is a necessary process in many contexts
to ensure legal compliance, security, accountability, trust, and efficiency. Without verification of
signature, there is a risk of fraud, disputes, and a lack of confidence in the integrity of important
transactions and documents.

1.1 Existing System


1. Acquisition: The digital signature is obtained through scanning a physical document or
using digital input devices such as a stylus or a tablet. This step captures the signature as a
digital image.
2. Preprocessing: The acquired signature image undergoes preprocessing techniques to
enhance its quality and prepare it for further analysis. Preprocessing operations may
include resizing, normalization, noise reduction, and contrast enhancement. These
techniques aim to improve the clarity and remove any unwanted artifacts or distortions
from the signature image.
3. Feature Extraction: Relevant features are extracted from the preprocessed signature
image. These features capture distinctive characteristics of the signature that can be used
for comparison and verification. Commonly used features include shape-based properties
like the number of strokes, curvature, and endpoints, as well as texture-based properties
like pixel intensity variations or frequency domain features.
4. Signature Representation: The extracted features are converted into a mathematical
representation or a feature vector. This representation simplifies the signature for further

Dept.,AI&ML(2020 batch) 1 2022-23


processing and comparison. It condenses the important signature characteristics into a
compact form that can be easily compared with other signatures.
5. Matching and Verification: The signature representation is compared with reference
signatures or a database of known signatures. Various matching algorithms are employed
to determine the similarity or dissimilarity between the signatures. These algorithms may
include template matching, correlation-based methods, or machine learning classifiers
trained on labeled signature data. The matching process produces a similarity score or a
decision indicating whether the signature is genuine or not.

1.2 Proposed System


To address the limitations of the existing system, the proposed system leverages Digital
Image Processing (DIP) techniques for signature verification. DIP offers a data-driven approach
that utilizes advanced image processing algorithms and machine learning techniques to extract
meaningful features from signature images and make automated decisions.
The proposed system begins with the acquisition of signature images, either through scanning
or digital capture devices. These images undergo preprocessing steps, such as noise removal,
image enhancement, and normalization, to ensure optimal quality and consistency. The processed
images are then subjected to feature extraction techniques, where relevant information is extracted
to capture the distinctive characteristics of signatures. Common features used in DIP-based
signature verification include pixel intensity distribution, texture analysis, contour-based features,
and edge-based features. These extracted features serve as input to machine learning algorithms.
Machine learning algorithms, such as Support Vector Machines (SVM), Artificial Neural
Networks (ANN), or Convolutional Neural Networks (CNN), are employed to train a signature
verification model. The model learns from a labeled dataset comprising genuine and forged
signatures and establishes a decision boundary or classification function that can discriminate
between genuine and forged signatures. During the testing phase, unseen signature images are
evaluated by the trained model, and their authenticity is determined based on the model's
classification output.
The proposed system offers several advantages over the existing system. By leveraging DIP
techniques and machine learning algorithms, it can handle complex variations and adapt to
different writing styles. The automated nature of the system reduces reliance on manual rule
definition, minimizing subjectivity and improving consistency. Additionally, the use of machine
learning enables the system to learn from large datasets, leading to improved accuracy and
robustness in signature verification.
Dept.,AI&ML(2020 batch) 2 2022-23
Chapter 2
Literature Review

1. "Offline Signature Verification and Recognition: An Overview" by A. Kumar et al. (2012):


 This paper provides an overview of offline signature verification techniques, including
feature extraction methods, matching algorithms, and performance evaluation metrics.
It discusses various approaches such as template-based matching, statistical and
geometrical features, and artificial intelligence-based techniques.
2. "A Survey on Off-line Signature Verification" by M. Ferrer et al. (2013):
 This survey paper presents a comprehensive review of offline signature verification
methods, focusing on both global and local feature extraction techniques, as well as
classification and matching algorithms. It discusses the challenges and future research
directions in the field.
3. "Online Signature Verification: Techniques and Features" by A. Konwar et al. (2016):
 This paper focuses on online signature verification methods, where dynamic
information captured during the signing process is utilized. It discusses various features
extracted from the online signature signals, such as pen speed, pressure, and direction.
The paper also covers different classification and verification techniques specific to
online signatures.
4. "A Review of Signature Recognition Methods" by V. K. Govindan et al. (2015):
 This review paper provides an overview of signature recognition techniques, including
verification and identification methods. It covers both offline and online signature
recognition, discussing feature extraction methods, matching algorithms, and system
evaluation metrics. The paper also highlights the challenges and open research areas in
the field.

Dept.,AI&ML(2020 batch) 3 2022-23


Chapter 3
System Design

3.1 Algorithm
In signature verification systems, the OC-SVM (One-Class Support Vector Machines)
algorithm is often used for anomaly detection. Here's an explanation of how the OC-SVM
algorithm works in the context of signature verification:
1. Training Phase:

 In the training phase of the OC-SVM algorithm, only genuine or authentic signature
samples are used. Anomaly detection techniques are employed to learn the
characteristics of genuine signatures and define a decision boundary that separates them
from potential outliers.

 The training set consists of feature vectors extracted from the genuine signature
samples. These features capture the distinctive properties and patterns of genuine
signatures.

 The OC-SVM algorithm aims to find a hyperplane in a high-dimensional feature space


that encloses the majority of the genuine signature samples, while minimizing the
number of outliers or anomalous samples.
2. Model Creation:

 The OC-SVM algorithm constructs a model based on the training data, specifically
designed to identify anomalies or deviations from the learned representation.

 The algorithm finds the optimal hyperplane that maximizes the margin between the
hyperplane and the closest genuine signature samples, while still enclosing the majority
of the training samples.

 The hyperplane is defined using a set of support vectors, which are the training samples
located closest to the decision boundary.
3. Testing/Verification Phase:

 During the testing or verification phase, a new or unseen signature sample is presented
to the trained OC-SVM model.

 The feature vector is extracted from the test sample, capturing its relevant properties.

 The OC-SVM model evaluates the test sample based on its proximity to the decision
boundary learned during the training phase.

Dept.,AI&ML(2020 batch) 4 2022-23


 If the test sample lies within the decision boundary or close to the majority of the
support vectors, it is considered a genuine signature. Otherwise, it may be classified as
an anomaly or a potential forgery.
4. Decision Making:

 Based on the output of the OC-SVM algorithm, a decision is made regarding the
authenticity of the signature.

 If the test sample is classified as within the decision boundary, it is considered a valid
signature.

 If the test sample is classified as outside the decision boundary, it indicates a potential
anomaly or forgery, triggering further investigation or additional verification steps.

3.3 Data Flow

Dept.,AI&ML(2020 batch) 5 2022-23


Acquire Image: This step involves capturing or loading an image into the system. The image
could come from various sources such as a camera, file, or network stream.

Image Preprocessing: Preprocessing is performed to enhance the image quality and make it
suitable for further analysis. It may involve operations like resizing, color space conversion, and
contrast adjustment.

Binarization: Binarization is the process of converting a gray scale or color image into a binary
image, where each pixel is either black or white. This step is often used to simplify subsequent
processing and extract meaningful features.

Background Noise Reduction: In many real-world images, there might be unwanted noise or
artifacts in the background that can interfere with object recognition. Background noise reduction
techniques aim to eliminate or reduce such noise, improving the accuracy of subsequent steps.

Segmentation: Segmentation refers to the partitioning of an image into meaningful regions or


objects. It involves identifying and separating foreground objects from the background. Different
algorithms can be used for segmentation, such as thresholding, edge detection, or region growing.

Extraction of Selected Objects: Once the image has been segmented, this step involves
extracting the objects or regions of interest from the segmented image. Depending on the
application, this could be accomplished by various methods such as connected component
analysis, contour detection, or template matching.

Train the Classifier: To perform recognition or matching, a classifier needs to be trained. This
step involves preparing a labeled dataset where each object or region of interest is associated with
its corresponding class or category. The classifier is then trained using this dataset to learn the
patterns and features that distinguish different classes.

Perform Matching: After the classifier is trained, it can be used to perform matching or
recognition on new images. The matching process involves feeding the extracted objects or
regions of interest into the trained classifier, which will determine the class or category of each
object based on its learned knowledge. The matching results can be further analyzed or used for
decision-making purposes.

Dept.,AI&ML(2020 batch) 6 2022-23


Chapter 3

Implementation

import numpy as np
import cv2
from matplotlib import pyplot as plt
import pandas as pd
import math
from sklearn import preprocessing
from sklearn import svm

#original image
img = cv2.imread('C:\\Users\\HP\\Downloads\\signature.png',0)
plt.imshow(img,'gray')
plt.show()

#Applying Gaussian Blurring and Otsu Thresholding for Binarization


blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
image=np.invert(th3)
plt.imshow(image,'gray')
plt.show()

# Cropping image to get bounding box


def crop_image(img,tol=0):
# img is image data
# tol is tolerance
mask = img>tol
return img[np.ix_(mask.any(1),mask.any(0))]

cimg=crop_image(image,tol=0)
plt.imshow(cimg,'gray')
plt.show()

# Thinning the image


def thinning(img):
#img = cimg
size = np.size(img)
skel = np.zeros(img.shape,np.uint8)

ret,img = cv2.threshold(img,127,255,0)
element = cv2.getStructuringElement(cv2.MORPH_CROSS,(3,3))
done = False

while( not done):


eroded = cv2.erode(img,element)
temp = cv2.dilate(eroded,element)

Dept.,AI&ML(2020 batch) 7 2022-23


temp = cv2.subtract(img,temp)
skel = cv2.bitwise_or(skel,temp)
img = eroded.copy()

zeros = size - cv2.countNonZero(img)


if zeros==size:
done = True

# plt.imshow(skel,'gray')
# plt.show()
return skel

timg=thinning(cimg)
plt.imshow(timg,'gray')
plt.show()

# Finding number of white pixels and connected components in signature


area=cv2.countNonZero(cimg)
print(area)
img1=np.invert(cimg)
cc=cv2.connectedComponents(img1)[0]
print(cc)

# Dividing image into 4 parts


def coords(timg):
rows,cols=timg.shape
img_tl=timg[0:int(rows/2),0:int(cols/2)]
img_tr=timg[int(rows/2)+1:rows,0:int(cols/2)]
img_bl=timg[0:int(rows/2),int(cols/2)+1:cols]
img_br=timg[int(rows/2)+1:rows,int(cols/2)+1:cols]

tl_x,tl_y=COG(img_tl)
tr_x,tr_y=COG(img_tr)
bl_x,bl_y=COG(img_bl)
br_x,br_y=COG(img_br)

return tl_x,tl_y,tr_x,tr_y,bl_x,bl_y,br_x,br_y
rows,cols=timg.shape
img_tl=timg[0:int(rows/2),0:int(cols/2)]
img_tr=timg[int(rows/2)+1:rows,0:int(cols/2)]
img_bl=timg[0:int(rows/2),int(cols/2)+1:cols]
img_br=timg[int(rows/2)+1:rows,int(cols/2)+1:cols]

#fig,ax=plt.subplots(nrows=1,ncols=1)
plt.imshow(img_tl,'gray')
plt.show()
plt.imshow(img_tr,'gray')
plt.show()
plt.imshow(img_bl,'gray')
plt.show()
plt.imshow(img_br,'gray')
plt.show()

Dept.,AI&ML(2020 batch) 8 2022-23


# Finding Centre of gravity of each sub-image
def COG(img):
x_cor=0
xrun_sum=0
y_cor=0
yrun_sum=0
#print(img.shape)
for i in range(img.shape[0]):
x_cor+=sum(img[i])*i/255
xrun_sum+=sum(img[i])/255

for i in range(img.shape[1]):
y_cor+=sum(img[:,i])*i/255
yrun_sum+=sum(img[:,i])/255
#print(img.shape[1])
if yrun_sum==0:
x_pos=0
else:
x_pos=y_cor/(yrun_sum)
if xrun_sum==0:
y_pos=0
else:
y_pos=x_cor/(xrun_sum)

# print(x_pos)
# print(y_pos)

return (x_pos/img.shape[1],y_pos/img.shape[0])
COG(img_bl)

# Generating feature dataset of original images!


data=[]
for i in range(1,56):
# print(i)
for j in range(1,25):
path=f'C:\\Users\\HP\\Downloads\\signature.png'
img = cv2.imread(path,0)
blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
image=np.invert(th3)

cimg=crop_image(image,tol=0)
area=cv2.countNonZero(cimg)/(cimg.shape[0]*cimg.shape[1])
#Find proportion of white cells
img1=np.invert(cimg)

cc=cv2.connectedComponents(img1)[0]
#Generate connected components

timg=thinning(cimg)
#Thinning the image!

Dept.,AI&ML(2020 batch) 9 2022-23


tl_x,tl_y,tr_x,tr_y,bl_x,bl_y,br_x,br_y=coords(timg)
#Extracting features

x=pd.Series([i,j,area,cc,tl_x,tl_y,tr_x,tr_y,bl_x,bl_y,br_x,br_y],index=

["Writer_no","Sample_no","area","connected_comps","tl_x","tl_y","tr_x","tr_y","bl_x","bl_y",
"br_x","br_y"])
data.append(x)
df=pd.DataFrame(data)

# Generating forgery feature dataset


data_f=[]
for i in range(1,56):
# print(i)
for j in range(1,25):
path=f'C:\\Users\\HP\\Downloads\\signature (1).png'
img = cv2.imread(path,0)
blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
image=np.invert(th3)

cimg=crop_image(image,tol=0)
area=cv2.countNonZero(cimg)/(cimg.shape[0]*cimg.shape[1])
#Find proportion of white cells
img1=np.invert(cimg)

cc=cv2.connectedComponents(img1)[0]
#Generate connected components

timg=thinning(cimg)
#Thinning the image!

tl_x,tl_y,tr_x,tr_y,bl_x,bl_y,br_x,br_y=coords(timg)
#Extracting features

x=pd.Series([i,j,area,cc,tl_x,tl_y,tr_x,tr_y,bl_x,bl_y,br_x,br_y],index=

["Writer_no","Sample_no","area","connected_comps","tl_x","tl_y","tr_x","tr_y","bl_x","bl_y",
"br_x","br_y"])
data_f.append(x)
df_f=pd.DataFrame(data_f)

# Generating alternate feature dataset


# Splitting the image into 8 parts, then calculating tan inverse of centre of gravity of each part
def tan_i(x):
#print(x)
if x[0]==0:
return 90
return math.degrees(math.atan(x[1]/x[0]))

def alt_coords(timg):
rows,cols=timg.shape
Dept., AI&ML(2020-Batch) 1 2022-23
img_tl1=timg[0:int(rows/2),0:int(cols/4)]
img_tl2=timg[0:int(rows/2),int(cols/4)+1:int(cols/2)]

img_tr1=timg[0:int(rows/2),int(cols/2)+1:int(0.75*cols)]
img_tr2=timg[0:int(rows/2),int(0.75*cols)+1:cols]

img_bl1=timg[int(rows/2)+1:rows,0:int(cols/4)]
img_bl2=timg[int(rows/2)+1:rows,int(cols/4)+1:int(cols/2)]

img_br1=timg[int(rows/2)+1:rows,int(cols/2)+1:int(0.75*cols)]
img_br2=timg[int(rows/2)+1:rows,int(0.75*cols)+1:cols]

#plt.imshow(timg,'gray')
#plt.show()

tl1=tan_i(COG(img_tl1))
tl2=tan_i(COG(img_tl2))
tr1=tan_i(COG(img_tr1))
tr2=tan_i(COG(img_tr2))
bl1=tan_i(COG(img_bl1))
bl2=tan_i(COG(img_bl2))
br1=tan_i(COG(img_br1))
br2=tan_i(COG(img_br2))

#plt.imshow(img_br1,'gray')
#plt.show()
#print(COG(img_br1))
return tl1,tl2,tr1,tr2,bl1,bl2,br1,br2

alt_coords(timg)

# Generating alternate original feature dataset


alt_data=[]
#df=pd.DataFrame(columns=["Writer_no","Sample_no","area","connected_comps"])
for i in range(1,56):
# print(i)
for j in range(1,25):
path=f'C:\\Users\\HP\\Downloads\\signature.png'
img = cv2.imread(path,0)
blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
image=np.invert(th3)

cimg=crop_image(image,tol=0)
area=cv2.countNonZero(cimg)/(cimg.shape[0]*cimg.shape[1])
#Find proportion of white cells
img1=np.invert(cimg)

cc=cv2.connectedComponents(img1)[0]
#Generate connected components
Dept., AI&ML(2020-Batch) 1 2022-23
timg=thinning(cimg)
#Thinning the image!

tl1,tl2,tr1,tr2,bl1,bl2,br1,br2=alt_coords(timg)
#Extracting features

x=pd.Series([i,j,area,cc,tl1,tl2,tr1,tr2,bl1,bl2,br1,br2],index=
["Writer_no","Sample_no","area","connected_comps","tl1","tl2","tr1","tr2","bl1","bl2",
"br1","br2"])
alt_data.append(x)
alt_df=pd.DataFrame(alt_data)

# Alternate forgery feature dataset generation


alt_data_f=[]
#df=pd.DataFrame(columns=["Writer_no","Sample_no","area","connected_comps"])
for i in range(1,56):
# print(i)
for j in range(1,25):
path=f'C:\\Users\\HP\\Downloads\\signature (1).png'
img = cv2.imread(path,0)
blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
image=np.invert(th3)

cimg=crop_image(image,tol=0)
area=cv2.countNonZero(cimg)/(cimg.shape[0]*cimg.shape[1])
#Find proportion of white cells
img1=np.invert(cimg)

cc=cv2.connectedComponents(img1)[0]
#Generate connected components

timg=thinning(cimg)
#Thinning the image!

tl1,tl2,tr1,tr2,bl1,bl2,br1,br2=alt_coords(timg)
#Extracting features

x=pd.Series([i,j,area,cc,tl1,tl2,tr1,tr2,bl1,bl2,br1,br2],index=
["Writer_no","Sample_no","area","connected_comps","tl1","tl2","tr1","tr2","bl1","bl2",
"br1","br2"])
alt_data_f.append(x)
alt_df_f=pd.DataFrame(alt_data_f)

# Using One-Class SVM


# Pre-processing data
alt_df.area=preprocessing.scale(alt_df.area)
alt_df.connected_comps=preprocessing.scale(alt_df.connected_comps)
alt_df.tl1=preprocessing.scale(alt_df.tl1)
alt_df.tl2=preprocessing.scale(alt_df.tl2)
alt_df.tr1=preprocessing.scale(alt_df.tr1)
Dept., AI&ML(2020-Batch) 1 2022-23
alt_df.tr2=preprocessing.scale(alt_df.tr2)
alt_df.bl1=preprocessing.scale(alt_df.bl1)
alt_df.bl2=preprocessing.scale(alt_df.bl2)
alt_df.br1=preprocessing.scale(alt_df.br1)
alt_df.br2=preprocessing.scale(alt_df.br2)

# Choosing dataset
os=24*32
data=alt_df.iloc[0+os:14+os]
print(data.shape)
data=data.drop("Writer_no",axis=1)
data=data.drop("Sample_no",axis=1)

# Tuning SVM for optimal parameters


def tuning_SVM(data):
max1=0
maxsv=0
best_nu=0
best_gamma=0
for i in range(1,100):
for j in range(1,100):
clf = svm.OneClassSVM(nu=0.01*i, kernel="rbf", gamma=0.005*j)
clf.fit(data)
x=clf.predict(data)
#print(clf.decision_function(data))
if (len(x[x==1]) > max1) and len(clf.support_vectors_) > maxsv :
best_nu=0.01*i
best_gamma=0.005*j
#print(len(x[x==1]))
#print(len(clf.support_vectors_))
max1=len(x[x==1])
maxsv=len(clf.support_vectors_)

return best_nu,best_gamma
#print("Optimal parameters are ",best_nu,best_gamma)

# Generating test dataset


li=[os+i for i in range(0,24)]
test_m=alt_df.drop(alt_df.index[li])
rand_signs=test_m.sample(n=20)
test=alt_df.iloc[14+os:24+os]
test=test.append(rand_signs)
test=test.drop("Writer_no",axis=1)
test=test.drop("Sample_no",axis=1)
print(test.shape)

from sklearn import svm


clf = svm.OneClassSVM(nu=best_nu, kernel="rbf", gamma=best_gamma)
clf.fit(data)
preds=clf.predict(test)
print(preds)

Dept., AI&ML(2020-Batch) 1 2022-23


pdf1=clf.decision_function(test[0:10])
pdf2=clf.decision_function(test[10:])
pdf=clf.decision_function(test)

def AER(preds):
ac=preds[0:10]
FRR=len(ac[ac==-1])/len(ac)
fg=preds[10:]
FAR=len(fg[fg==1])/len(fg)
AER1=(FRR+FAR)/2
return round(AER1*100,3)

print("The average error rate with hard thresholding is ", AER(preds))


print(preds)

def AER2(preds):
ac=preds[0:10]
FRR=ac.count(-1)/len(ac)
fg=preds[10:]
FAR=fg.count(1)/len(fg)
AER1=(FRR+FAR)/2
return round(AER1*100,3),FRR,FAR

def soft_thres(pdf,pdf1):
m=np.mean(pdf1)
sig=np.std(pdf1)
best_thres=0
best_AER=100
best_FFR=100
best_FAR=100
for k in range(-300,300):
k_d=k/100
thres=m+k_d*sig
preds2=[1 if x >= thres else -1 for x in pdf]
#print(preds2)
cur_AER,FRR,FAR=AER2(preds2)
# print(k_d)
if cur_AER < best_AER:
best_AER=cur_AER
best_thres=thres
best_FRR=FRR
best_FAR=FAR
return best_thres,best_FRR,best_FAR,best_AER

def fixed_soft_thres(pdf,thres):
preds2=[1 if x >= thres else -1 for x in pdf]
cur_AER,FRR,FAR=AER2(preds2)
return cur_AER,FRR,FAR

# Aggregating data for 30 writers


24*42

Dept., AI&ML(2020-Batch) 1 2022-23


import random
li=random.sample(range(0,55),30)
li

# Dataset of 30 writers
master_pdf1 = np.array([])
master_pdf2 = np.array([])
master_data = []

for i in li:
os = 24 * i
data = alt_df.iloc[0 + os:14 + os]
data = data.drop("Writer_no", axis=1)
data = data.drop("Sample_no", axis=1)

li1 = [os + j for j in range(0, 24)]


test_m = alt_df.drop(alt_df.index[li1])
rand_signs = test_m.sample(n=20)

test = alt_df.iloc[14 + os:24 + os]


test = test.append(rand_signs)
test = test.drop("Writer_no", axis=1)
test = test.drop("Sample_no", axis=1)

best_nu, best_gamma = tuning_SVM(data)


if best_nu <= 0 or best_nu > 1:
best_nu = 0.5
clf = svm.OneClassSVM(nu=best_nu, kernel="rbf", gamma='auto')
clf.fit(data)
preds = clf.predict(test)

aer_h = AER(preds)

pdf1 = clf.decision_function(test[0:10])
pdf2 = clf.decision_function(test[10:])
pdf = clf.decision_function(test)
master_pdf1 = np.append(master_pdf1, pdf1)
master_pdf2 = np.append(master_pdf2, pdf2)
soft_t, frr, far, aer_s = soft_thres(pdf, pdf1)

x = pd.Series([i + 1, best_nu, best_gamma, aer_h, soft_t, aer_s, frr, far], index=


["Writer_no", "Best_nu", "Best_gamma", "Hard_AER", "Soft_Threshold", "Soft_AER",
"FRR", "FAR"])
master_data.append(x)

master_df = pd.DataFrame(master_data)
master_df

print("Average AER with hard thresholding is ",np.mean(master_df.Hard_AER))


print("Average AER with soft thresholding is ",np.mean(master_df.Soft_AER))
print("Average soft threshold is ",np.mean(master_df.Soft_Threshold))

Dept., AI&ML(2020-Batch) 1 2022-23


# Testing above generated numbers of remaining 25 writers
#Using average parameter and threshold value
nu=np.mean(master_df.Best_nu)
gamma=np.mean(master_df.Best_gamma)
thres=np.mean(master_df.Soft_Threshold)
li2=[]
for i in range(0,55):
if i not in li:
li2.append(i)
testing_pdf1=np.ndarray(1)
testing_pdf2=np.ndarray(1)
testing_data=[]
for i in li2:
os=24*i
#print(i)
data=alt_df.iloc[0+os:14+os]
#print(data.shape)
data=data.drop("Writer_no",axis=1)
data=data.drop("Sample_no",axis=1)

li1=[os+j for j in range(0,24)]

test_m=alt_df.drop(alt_df.index[li1])
rand_signs=test_m.sample(n=20)

test=alt_df.iloc[14+os:24+os]
test=test.append(rand_signs)
test=test.drop("Writer_no",axis=1)
test=test.drop("Sample_no",axis=1)

clf = svm.OneClassSVM(nu=nu, kernel="rbf", gamma='auto')


clf.fit(data)
preds=clf.predict(test)

aer_h=AER(preds)

pdf1=clf.decision_function(test[0:10])
pdf2=clf.decision_function(test[10:])
pdf=clf.decision_function(test)
testing_pdf1=np.append(testing_pdf1,pdf1)
testing_pdf2=np.append(testing_pdf2,pdf2)
aer_s,frr,far=fixed_soft_thres(pdf,thres)
x=pd.Series([i+1,aer_h,aer_s,frr,far],index=
["Writer_no","Hard_AER","Soft_AER","FRR","FAR"])
testing_data.append(x)
testing_df=pd.DataFrame(testing_data)
testing_df
print("Average AER with hard thresholding is ",np.mean(testing_df.Hard_AER))
print("Average AER with soft thresholding is ",np.mean(testing_df.Soft_AER))

Dept., AI&ML(2020-Batch) 1 2022-23


Chapter 4
Results with Screen-Shots

Fig 4.1 Original Image

Fig 4.2 Applying Gaussian Blurring and Otsu Thresholding for Binarization

Fig 4.3 Cropping image to get bounding box

Dept., AI&ML(2020-Batch) 1 2022-23


Fig 4.4 Thinning the image

Fig 4.5 Dividing image into 4 parts

Fig 4.6 original feature dataset

Fig 4.7 forgery features dataset

Dept., AI&ML(2020-Batch) 1 2022-23


Fig 4.8 Alternate original dataset

Fig 4.9 Alternate forgery dataset

Fig 4.10 Testing 25 Writers

Dept., AI&ML(2020-Batch) 1 2022-23


Conclusion

In conclusion, the verification of signatures using Digital Image Processing techniques


offers a promising solution to automate and improve the accuracy of the signature verification
process. By leveraging advanced image processing algorithms and machine learning techniques.
DIP-based signature verification systems have shown potential in addressing the limitations of
traditional manual inspection methods.
Through our study, we have explored the existing systems and techniques used in
signature verification with DIP. These techniques include preprocessing, feature extraction, and
classification algorithms. Preprocessing steps such as noise removal, image enhancement,
normalization, and resizing are applied to improve the quality and standardize the characteristics
of signature images. Feature extraction techniques capture relevant information from signatures,
such as pixel intensity distribution, texture analysis, edge detection, or contour analysis.
Classification algorithms, including One-Class Support Vector Machines (OCSVM), are
employed to differentiate between genuine signatures and potential forgeries.
The literature review and survey outcomes have provided insights into the performance of
existing DIP-based signature verification systems. While these systems have shown promising
results in terms of accuracy and efficiency, challenges still exist, such as variations in writing
styles, natural variations in genuine signatures, and the presence of skilled forgers. The
availability of large-scale labeled datasets for training and evaluating signature verification
models remains a challenge in this field.
However, the integration of DIP techniques in signature verification has demonstrated
several advantages. Automated systems reduce the subjectivity and biases associated with
manual inspection, improve efficiency, and enable real-time verification. Moreover, DIP-based
approaches can handle various types of signatures, including handwritten and digital signatures,
and can be applied to different document types and formats.

Dept., AI&ML(2020-Batch) 2 2022-23


References

[1] "Offline Signature Verification and Recognition: An Overview" by A. Kumar et al. (2012)

[2] "A Survey on Off-line Signature Verification" by M. Ferrer et al. (2013)

[3] "Online Signature Verification: Techniques and Features" by A. Konwar et al. (2016)

[4] "A Review of Signature Recognition Methods" by V. K. Govindan et al. (2015)

Dept., AI&ML(2020-Batch) 2 2022-23

You might also like