Random Corner Patches
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
Has anyone got any ideas on how to create random image corner features. eg a random curved edge with one side consisting of larger magnitude than the other side. I wish to be able to generate random corners patches automatically such as those found in real images as would be extracted by a corner detector such as Harris.
An example of a patch is here
http://mi.eng.cam.ac.uk/~twd20/Research/fast-corner.jpg
Thanks for any ideas
Mike
0 comentarios
Respuestas (2)
Brett Shoelson
el 14 de Feb. de 2011
Harris corner detection is the default for the Image Processing Toolbox function corner. It's also available as a block in the Video and Image Processing Blockset (or as a System Object!).
Cheers,
Brett
0 comentarios
David Young
el 14 de Feb. de 2011
It depends on how you plan to use the random corners, and what statistics or other properties you want them to have.
If you want to get a set of patches with the sort of corners that the Harris detector would find, how about just taking a load of natural images, putting them through a corner detector, and pulling out a patch round each corner? You could extend the set further by randomly rotating and scaling each patch.
Alternatively, if you want truly synthetic patches, with control over the statistics and a generative model, perhaps something along the following lines might be useful.
% Generate a random texture by smoothing random noise
r = rand(400,400)-0.5;
sigma1 = 10;
g = fspecial('gauss', 2*round(2.5*sigma1)+1, sigma1);
s = filter2(g, r, 'valid');
% Make it more "edgy" by thresholding, and then smoothing a little
sigma2 = 4;
g = fspecial('gauss', 2*round(2.5*sigma2)+1, sigma2);
im = filter2(g, double(s > 0), 'valid');
% Find the corners and plot them
c = corner(im);
imshow(im, []);
hold on;
plot(c(:, 1), c(:, 2), 'r*');
hold off;
Whether you're using natural images or somthing like my synthetic texture, you can pull out cornery patches like this:
% Grab a typical corner-centred patch
half_patchsize = 10;
random_patch_no = ceil(rand * size(c,1));
xc = c(random_patch_no, 1);
yc = c(random_patch_no, 2);
patch = im(yc-half_patchsize:yc+half_patchsize, ...
xc-half_patchsize:xc+half_patchsize);
imshow(patch, []);
Put comments on this answer if you'd like to discuss it.
0 comentarios
Ver también
Categorías
Más información sobre Image Processing and Computer Vision 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!