image processing - How to get user freehand input in matlab? -


i trying write handwriting recognization software, , need user input. can use imfreehand (with parameter, closed = 0) function let user write on top of blank plot axis. however, have 2 issues that:

  1. i cannot control thickness of lines
  2. i cannot convert scribble image

i need 2, because, comparing handwriting training images stored in library.

any idea on how on these or alternatives?

thanks.

to answer second question first, can use getframe. here minimal exemple:

% --- free hand drawing imfreehand('closed', 0);  % --- image axis off f = getframe; img = f.cdata;  % --- display image figure imshow(img); 

then, answer first question regarding line thickness, it's little bit more tricky. have coordinates of curve, plot desired thickness , use getframe.

it's little more complicated make clean respect application because of background color , axes scales, here try:

clf xl = get(gca, 'xlim'); yl = get(gca, 'ylim');  h = imfreehand('closed', 0);  % --- curve coordinates c = get(h, 'children'); pos = c(5).vertices;  % --- re-plot curve thick line clf plot(pos(:,1), pos(:,2), 'k', 'linewidth', 5); xlim(xl); ylim(yl);  % --- image f = getframe; img = rgb2gray(f.cdata); img(img>0) = 255;  % --- display image clf imshow(img); 

hope helps !


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -