Graphics - The MathWorks - #351

/ 667


catalogue search
P. 351
P. 352
P. 353
P. 354
P. 355
P. 356
P. 357
P. 358
P. 359
P. 360
P. 361
P. 362
P. 363
P. 364
P. 365
P. 366
P. 367
P. 368
P. 369
P. 370
P. 371
P. 372
P. 373
P. 374
P. 375
P. 376
P. 377
P. 378
P. 379
P. 380
P. 381
P. 382
P. 383
P. 384
P. 385
P. 386
P. 387
P. 388
P. 389
P. 390
P. 391
P. 392
P. 393
P. 394
P. 395
P. 396
P. 397
P. 398
P. 399
P. 400


See other catalogues for The MathWorks

Text version of the page
The Image Object and Its Properties
Note Setting erasemode to xor can have unpredictable and undesirable results, depending on your platform and its display system, and may not be particularly efficient.
When you are using this animation technique with larger data sets, in order to achieve maximum speed you can turn off double buffering for the figure, as follows:
set(gcf,'doubleBuffer' ,'off)
Adding Text to Images
You can use basic array indexing to rasterize text strings into an existing image, as follows:
Draw the text strings using text, and then capture a bitmapped version of them using getframe. Then find the black pixels and convert their subscripts to indexes using sub2ind. Use these subscripts to "paint" the text into the image into which you want to add the text string, then save that image. Here isanexampleusingtheimageinthedemoMAT-filemandrill.mat:
% Create the text in an axis: t = text(.05,.1,'Mandrm Face', ...
'FontSize',12, 'FontWeight','demi');
% Capture the text from the screen: F = getframe(gca,[10 10 200 200]);
% Close the figure: close
% Select any plane of the resulting RGB image: c = F.cdata(:,:,1);
% 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):
6-33

pageCatalog pdf di En 2012-06-22-01