Image authentication using color information
1 次查看(过去 30 天)
显示 更早的评论
I am using attached script for splitting the image into 21 blocks (for Red, Green and Blue channels) and then compare each block pixel by pixel.
However, I want to do some changes as below:
1) How can I divide the image automatically into n number of equal blocks ( so I will just have to say 10 and it will divide the image into 10 equal size blocks).
2) I used isequal() function for comparison two blocks. How can I get the distance between two blocks. (Like Euclidean distance or something)
3) How to compare RGB histogram for each block. (Here I think it is possible to only compare the Y axis as X axis of the histogram will be 0 to 255 for all the blocks.) I know how to generate histogram but I dont know how to use that information for the comparison.
4) How can I keep some threshold e.g after comparison if all the blocks are matching > 98% then it is a true image OTW false image detected.
Thank you in advance.
11 个评论
采纳的回答
Guillaume
2018-12-4
1. Dividing an image of size HxW into MxN blocks where M and N are divisors of H and W respectively:
%inputs:
% img: an image (2D or 3D numeric array)
% M, N: the number of blocks along the rows, columns respectively
%output:
% block: a M x N cell array of 2D or 3D numeric arrays
blocks = mat2cell(img, ones(1, M) * size(img, 1) / M, ones(1, N) * size(img, 2) / N, size(img, 3)); %will error if M and N are not divisors of H and W
2. It seems to me that you haven't defined your comparison metric. You probably need to do some research on what it should be. Once you've defined that, it's easy to perform the comparison. Here, I'm using the square root of the sum of the square of the differences between corresponding pixels of each block. I have no idea if it is a good metric, as it's not my field:
%inputs:
% blocks1: blocks of 1st image. M x N cell array of 2D or 3D numeric arrays
% blocks2: blocks of 2nd image. Same size as blocks1
%outputs:
% comparison: a M X N double array of euclidean distance between each matching block.
comparison = cellfun(@b1, b2) sqrt(sum((b1(:) - b2(:)) .^2)), blocks1, blocks2)
3. Again, making the comparison is trivial but you need to define a metric first.
11 个评论
Guillaume
2018-12-6
As I said it's not my domain. However, I'm sure you can find plenty of reliable methods in the plethora of papers that have been written on the subject.
更多回答(2 个)
Image Analyst
2018-12-7
Maybe you should just try ro register the images with imregister() and then use immse() and ssim().
Or you could also use Hu's moments
Or any of the feature matching things in the Computer Vision System Toolbox.
3 个评论
Image Analyst
2018-12-7
There are so very many things that could possibly be measured. For one, you could just compute the RGB histograms of each image. Better, why don't you look up forgery or forensics in VisionBibliography and you'll find lots of algorithms. Pick one or two and code them up:
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!