![]() |
| Script GRADARA_text.m | |||
|
|||
|
% Create the text in an axis:
t = text(.05,.5,'GRADARA', ... 'FontSize',24, 'FontWeight','demi') % Capture the text from the screen: F = getframe(gca,[10 10 200 200]) Fsize=size(F) % Close the figure: % close % Select any plane of the resulting RGB image: c1 = F.cdata(:,:,1); c2 = F.colormap c1size=size(c1) c2size=size(c2) % Note: If you have Image Processing Toolbox installed, % you can convert the RGB data from the frame to black or white: % c = rgb2ind(F.cdata,2); % Determine where the text was (black is 0): [i,j] = find(c1 == 0); Z0=c1(i(end),j(end)) sizei=size(i) sizej=size(j) %prima posizione whos % whos % Read in or load the image that is to contain %the text in the array X defined by MATLAB: % load mandrill [X,map4]=imread('Gradara.bmp'); sizeX=size(X) % Use the size of the X image, plus the row/column locations % of the text, to determine locations in the new image: %seconda posizione whos % whos ind = sub2ind(size(X),i,j); %terza posizione whos, i ind e j assumono valore 330 whos % % % Index into new image, replacing pixels with white: X(ind) = uint8(255); valueXend=X(end) % % % Display and color the new image: imagesc(X) axis off |
|||
| Back | |||