how to reduce the number of overlapping blocks taken for processing ?

조회 수: 2 (최근 30일)
gowripriya p
gowripriya p 2022년 5월 25일
답변: Milan Bansal 2023년 11월 20일
I am working on copy move forgery detection using DCT-KPCA. here image of size 512*512 is converted to overlapping blocks of size16*16. The total number of blocks will be very huge . Processing these much number of blocks is not neccessary for comparing the region of forgery . So I'm not knowing how to reduce the number of blocks to process KPCA , so that it takes minimum time for execution without losing the content of the image
  댓글 수: 2
Benjamin Thompson
Benjamin Thompson 2022년 5월 25일
Can you post your code and sample input images?
gowripriya p
gowripriya p 2022년 5월 26일
편집: gowripriya p 2022년 5월 26일
I have coded the DCT part and taken ready code for KPCA from net . I have attached the codes and images one forged and unforged. I also shared the reference paper I'm using. Hope you could help me out and thank you for your response.

댓글을 달려면 로그인하십시오.

답변 (1개)

Milan Bansal
Milan Bansal 2023년 11월 20일
Hi Gowripriya,
It is my understanding that you want to reduce the number of overlapping blocks to reduce the total time of processing for forgery detection using DCT-KPCA.
As per the code given in the attached file "dctpcacomofod.m", a window of size [16 16] is used to extract the overlapping blocks from the image with a stride of 1. As a result the total number of blocks becomes 247009.
In order to reduce the number of blocks, increase the window size and the value of stride at which the blocks are extracted from the image. Modify the code for extracting the blocks as shown in the code snippet below.
% increase the height and width of the window from 16 to 32
h=32;
w=32;
count = (f-h+1)*(e-w+1);
outMat = zeros(h,w,count);
l = 0;
% define the stride variable
stride = 4;
% Use the stride value for extracting blocks from the image
for i= 2: stride: e-(h-1)+1
for j=2:stride: f-(w-1)+1
l = l + 1;
outMat(:,:,l) = double(outImg((i-1:i+h-2),(j-1:j+w-2)));
end
end
With the above modifications, the number of blocks are reduced to 14641. Try different values of window size and stride for best results according to the applications.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by