[x] = imread('PICT0040.JPG'); imshow(x) y = im2bw(x); imshow(y) imshow(x); pause(2); imshow(y) whos Name Size Bytes Class Attributes x 819x1057x3 2597049 uint8 y 819x1057 865683 logical imshow(x) clear x - imread('PICT0009.JPG'); {Undefined function or variable 'x'. } x = imread('PICT0009.JPG'); imshow(x) [Warning: Image is too big to fit on screen; displaying at 33%] [> In imuitools/private/initSize at 71 In imshow at 282] clear clc x = imread('PICT0009.JPG'); imshow(x) title('Select 2 points'); xlabel('time'); ylabel('frequency'); [a, b] = ginput(2); a a = 665 806 b b = 107 249 whos Name Size Bytes Class Attributes a 2x1 16 double b 2x1 16 double x 705x908x3 1920420 uint8 y = x(107:665, 249:806, :); figure(2); imshow(y); [f,g] = ginput(1)l [f,g] = ginput(1)l | {Error: Unexpected MATLAB expression. } [f,g] = ginput(1); f f = 28.0000 g g = 148 disp(sprintf('%d, %d', f, g)); 2.800000e+01, 148 disp(sprintf('%3d, %3d', f, g)); 2.800000e+01, 148 f f = 28.0000 format long f f = 27.999999999999943 disp(sprintf('%3d, %3d', round(f), round(g))); 28, 148 for 1:20 for 1:20 | {Error: Unexpected MATLAB expression. } for i=1:20 [f,g] = ginput(1); disp(sprintf('%3d, %3d', round(f), round(g))); end 350, 287 553, 191 158, 162 238, 507 17, 425 129, 429 170, 414 169, 497 169, 543 167, 593 167, 620 8, 7 894, 685 761, 502 629, 467 486, 377 396, 369 385, 338 444, 318 444, 293 [a, b] = ginput(2); a a = 1.0e+02 * 0.139999999999999 8.990000000000000 b b = 220 410 round(a) ans = 14 899 y = x(220:410, 14:899, :); figure(2); imshow(y); y = x(107:665, 249:806, :); figure(2); imshow(y); y = x(249:806, 107:665, :); {Index exceeds matrix dimensions. } y = x(107:249, 665:806, :); figure(2); imshow(y); whos Name Size Bytes Class Attributes a 2x1 16 double ans 2x1 16 double b 2x1 16 double f 1x1 8 double g 1x1 8 double i 1x1 8 double x 705x908x3 1920420 uint8 y 143x142x3 60918 uint8 f = x(1:100,77,1); plot(f) plot(1:length(f),f, 'b') plot(1:length(f),f, 'k') g = x(1:100,79,1); 1:length(g) ans = Columns 1 through 10 1 2 3 4 5 6 7 8 9 10 Columns 11 through 20 11 12 13 14 15 16 17 18 19 20 Columns 21 through 30 21 22 23 24 25 26 27 28 29 30 Columns 31 through 40 31 32 33 34 35 36 37 38 39 40 Columns 41 through 50 41 42 43 44 45 46 47 48 49 50 Columns 51 through 60 51 52 53 54 55 56 57 58 59 60 Columns 61 through 70 61 62 63 64 65 66 67 68 69 70 Columns 71 through 80 71 72 73 74 75 76 77 78 79 80 Columns 81 through 90 81 82 83 84 85 86 87 88 89 90 Columns 91 through 100 91 92 93 94 95 96 97 98 99 100 plot(1:length(g), g, 'r'); plot((1:length(g))/100, g, 'r'); plot((1:length(f))/100,f, 'b') hold on plot((1:length(g))/100, g, 'r'); clf plot((1:length(f))/100,f, 'b.-') plot((1:length(f))/100,f, 'b-.') hold on plot((1:length(g))/100, g, 'r*'); plot((1:length(g))/100, g, 'm*-'); plot((1:length(g))/100, g, 'gd-'); plot((1:length(g))/100, g, 'yo-'); plot((1:length(g))/100, g, 'r*'); clc clf close all whos Name Size Bytes Class Attributes a 2x1 16 double ans 1x100 800 double b 2x1 16 double f 100x1 100 uint8 g 100x1 100 uint8 i 1x1 8 double x 705x908x3 1920420 uint8 y 143x142x3 60918 uint8 f = x(1:100,col,1); {Undefined function or variable 'col'. } for col=1:20 f = x(1:100,col,1); plot(f); end for col=1:20 f = x(1:100,col,1); plot(f); end for col=1:20 f = x(1:100,col,1); plot(f); pause end for col=1:20 f = x(1:100,col,1); plot(f); pause(1); end for col=1:20 f = x(1:100,col,1); plot(f); pause(0.1); end imshow(x) whos Name Size Bytes Class Attributes a 2x1 16 double ans 1x100 800 double b 2x1 16 double col 1x1 8 double f 100x1 100 uint8 g 100x1 100 uint8 i 1x1 8 double x 705x908x3 1920420 uint8 y 143x142x3 60918 uint8 imshow(x(:,:,1)) imshow(x(:,:,2)) imshow(x(:,:,3)) x(:,:,3) = 0; imshow(x(:,:,3)) imshow(x) x(:,:,2) = 0; imshow(x) exit