How to calculate the first-order statistical information for Afghani fake banknote detection?

I want to work on Afghani fake banknote detection project. and i need to crop the banknote image from it's background and then I need to calculate it's first-order statistical information (Variance ,Skewness ,Kurtosis ,and Entropy ) based of it's gray level histogram . so for this i wrote the below code, now can anyone help me , please check my codes and please let me know my code for calculation of the first-order statistical information is correct or not?
Because i am new in matlab so i need help to do this.
%% //Read in images
clear all;
close all;
rgbImage = imread('F:/final_project/dataset/Afghan_fake_banknotes/Real_1000/front/Train/real_39.jpg');
% Get the dimensions of the image. numberOfColorChannels should be = 3.
%rgbImage=imresize(rgbImage,[1024 768]);
[rows, columns, numberOfColorChannels] = size(rgbImage);
% Display the original color image.
subplot(2, 3, 1);
imshow(rgbImage);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'Outerposition', [0, 0, 1, 1]);
hsvImage = rgb2hsv(rgbImage);
sImage = hsvImage(:, :, 2);
subplot(2, 3, 2);
imshow(sImage, []);
subplot(2, 3, 3);
histogram(sImage);
grid on;
% Threshold.
mask = sImage > 0.1;
% Extract biggest blob.
mask = bwareafilt(mask, 1);
% Fill holes.
mask = imfill(mask, 'holes');
subplot(2, 3, 4);
imshow(mask);
% Get bounding box.
props = regionprops(logical(mask), 'BoundingBox');
% Crop image.
croppedImage = imcrop(rgbImage, props.BoundingBox);
subplot(2, 3, 5);
imshow(croppedImage);
% Grayscal Image
gray1=rgb2gray(croppedImage);
subplot(2, 3, 6);
%imshow(gray1);
% Wiener Filter
filter1=wiener2(gray1);
%filter2=medfilt2(gray1);
imshow(filter1);
%imshow(filter2);
%err1=immse(gray1,filter1);
%err2=immse(gray1,filter2);
histogram1=imhist(filter1);
var1=var(histogram1);
ske1=skewness(histogram1);
kur1=kurtosis(histogram1);
ento1=entropy(histogram1);

Answers (1)

I doubt you'd be able to tell from such a poor image. Inconsistent exposures, specular reflections, shadows, physical defects (tears, wrinkles, etc) -- it's a mess. For a reasonably good counterfeit I doubt even a human would be able to tell from the image capture setup you're using.
You'd be better off using a flat bed scanner, though that won't help with the shiny strips and holograms or other angle dependent features they may have in there. Even then it may be almost impossible for your program to find the difference between a legitimate note and a counterfeit one, epsecially if they're both heavily worn, and especially if you're converting the image to gray scale and only analyzing the gray scale version of the image. Only for the most obvious and blatant errors might you be able to find a difference, such as if the building was missing from the counterfeit note.

13 Comments

Sorry sir, for the delay in replying to your answer. Now I scanned the image of the banknote.Please help me and give me an advise which method to use.should i calculate the first-order statistical information or should i segment the ROIs from the pictures and extract features from the segmented ROIs.which one of them is good for Afghani fake banknote detection?
They look very much similar to me, except that the top note is a bit more worn and the blue vertical strips are different. So in this particular case you could look only at the blue strip. Which one is the legitimate note and which is the counterfeit? Whichever one it is, it's a pretty bad counterfeit. I doubt you'd have it so easy for other counterfeit notes.
One way is to just try to match colors and exposure with imhistmatch, and then align the images with imregister, and then subtract them with imabsdiff and count up the number of difference pixels with an intensity difference more than some specified number.
Thanks a lot sir, for your reply.
Actually sir, these 2 images are real banknots.
The below images are fake banknotes and unfortunately currently i don't have the scanned of these fake banknotes ,so for now please look at the following images and advise me.
As you said "count up the number of difference pixels with an intensity difference more than some specified number" so how should I do this? please give some guidance about this.
You would not be able to tell the difference from those two images.
I am really sorry sir, for the delay in replying to your answer.
Now I have the scanned image of the fake banknotes.Please sir help me and give me an advise.
Real 1000 AFG (1)
Real 1000 AFG (2)
Fake 1000 (1)
Fake 1000 (2)
Actually we have the 1000 AFG banknote in 2 shapes ( I mean the real 1000 AFG has 2 shape of vertical strips as you can see it real (1) & real (2) ). and now I need to extract features from the real and fake banknotes and then create a CSV file from these features.
So please give me some advise.
Again, I don't think you'd be able to tell a counterfeit or a badly worn legitimate note from a new legitimate note. You can try calling imregister() and imabsdiff() but for a really good counterfeit, there may be less difference than for a very worn/old true note.
Thanks a lot sir, for your reply. i will try this. just i have one another question. i saw in different papers for detection of indian banknotes researchers used calculation of the first order statistical information.So in which case we can use this type of technique?
Sure you can try it but you will need to calibrate your images with a ColorChecker chart since otherwise any difference in brightness or color dues to exposure or camera model (that is different from that used to image the legitimate note) could tell you that it's fake when it's not. Even so, unless the fake note is horribly and drastically different you might not notice, particularly because you need to put in some tolerance so that it does not flag legitimate notes as fake just because they are worn a lot.
Image Analyst, I have one another question about this topic and it would be a great help for me if you have the answer. If i don't use the rgb color images and convert them to gray level so in this case should i calibrate my images with a ColorChecker or not?
It's always best to have an intensity standard in there to correct for exposure differences. If you convert to gray scale, it's even more possible that you won't be able to tell legitimate notes from fake ones.

Sign in to comment.

Asked:

on 6 Oct 2022

Commented:

on 16 Nov 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!