Thursday, 8 December 2011

Matlab Image Patch Extraction Code | Patch Extraction from an Image matlab code

In Image patch extraction mainly used for Content Based Image Retrieval (CBIR) and Patter recognition systems.Here we give the code for patch extraction from an Image.In patch extraction also get the features from each patches in CBIR system. It also used segmentation computation.Patches also used to Recognize Face Synthesis process and detect Nose, eyes,mouth.Patches also support improve the image quality and remove the noise from an images.You have apply the filters on each patches then you get quality images.
In below code used for Patch extraction from an Image.

clc
clear all
close all

input = rgb2gray(imread('041078.JPG')); %converted into RGB color
patchsize = 10; %10*10 path size
imsize = 10*25;
input = imresize(input,[imsize imsize]);
figure;imshow(input);
image_out = [];
for i = 1:patchsize:imsize
image_out_tmp = [];
for j = 1:patchsize:imsize
tmp_img = input((i+1-1):i+patchsize-1,(j+1-1):j+patchsize-1);
tmp_img = [ones(patchsize,1) tmp_img ones(patchsize,1)];
tmp_img = [ones(1,patchsize+2);tmp_img;ones(1,patchsize+2)];
image_out_tmp = [image_out_tmp tmp_img];
end
image_out = [image_out;image_out_tmp];
end
figure;imshow(image_out);

This script out put as follows..


In above output for patch extraction.Here we give the patch sizes is 10.Then we extract the 10x10 patches from an Image.

Kindly Bookmark and Share it:

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...