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

5 visualizaciones (últimos 30 días)
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);

Respuestas (1)

Image Analyst
Image Analyst el 8 de Oct. de 2022
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 comentarios
hamida
hamida el 16 de Nov. de 2022
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?
Image Analyst
Image Analyst el 16 de Nov. de 2022
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by