>> |
street = iread('street.png');
|
>> | about(street) |
>> | street(200,300) |
>> >> | street_d = idouble(street); about(street_d) |
>> |
street_d = iread('street.png', 'double');
|
>> >> >> |
flowers = iread('flowers8.png');
about(flowers)
iprint(flowers, 'flowers') |
>> | pix = flowers(276,318,:) |
>> | about(pix) |
>> | squeeze(pix)' |
>> >> | idisp( flowers(:,:,1) ) iprint(flowers(:,:,1), 'flowers_red'); |
>> >> |
seq = iread('seq/*.png');
about(seq)
|
>> |
cam = AxisWebCamera('http://wc2.dartmouth.edu');
|
>> | cam.size() |
>> >> >> >> >> >> >> >> |
im = testpattern('rampx', 256, 2);
im = testpattern('siny', 256, 2);
im = testpattern('squares', 256, 50, 25);
im = testpattern('dots', 256, 256, 100);
iprint( testpattern('rampx', 256, 2), 'tp1');
iprint( testpattern('siny', 256, 2), 'tp2');
iprint( testpattern('squares', 256, 50, 25), 'tp3');
iprint( testpattern('dots', 256, 256, 100), 'tp4');
|
>> | canvas = zeros(200, 200); |
>> >> | sq1 = 0.5 * ones(40, 40); sq2 = 0.9 * ones(20, 20); |
>> >> | canvas = ipaste(canvas, sq1, [20, 40]); canvas = ipaste(canvas, sq2, [60, 120]); |
>> | circle = 0.6 * kcircle(30); |
>> | size(circle) |
>> | canvas = ipaste(canvas, circle, [100, 30]); |
>> | canvas = iline( canvas, [30, 40], [150, 190], 0.8); |
>> >> | idisp(canvas) iprint(canvas, 'canvas', 'square'); |
>> | imd = idouble(im); |
>> | im = iint(imd); |
>> | grey = imono(flowers); |
>> | color = icolor(grey); |
>> | color = icolor(grey, [1 0 0]); |
>> >> >> >> >> >> >> >> >> >> >> >> | clf ihist( street )
iprint('street_histo');
ihist(street, 'cdf');
nn=inormhist(street); hold on [n,v] = ihist(nn, 'cdf'); plot(v, n, 'r'); xaxis(255)
legend('original', 'normalized', 'Location', 'Southeast')
iprint('street_cdf');
clf
|
>> | [n,v] = ihist(street); |
>> | peak(n, v)' |
>> | peak(n, v, 'scale', 25)' |
>> >> >> | shadows = (street >= 30) & (street<= 80); idisp(shadows) iprint(iint(shadows), 'street_shadows'); |
>> | im = istretch(street); |
>> | ihist(street, 'cdf'); |
>> | im = igamma(street, 1/0.45); |
>> | im = igamma(street, 'sRGB'); |
>> >> |
subject = iread('greenscreen.jpg', 'double');
iprint( subject, 'subject'); |
>> >> | linear = igamma(subject, 'sRGB'); [r,g] = tristim2cc(linear); |
>> >> | ihist(g)
iprint('subject_histo');
|
>> >> >> | mask = g < 0.45; idisp(mask) iprint(mask, 'subject_mask'); |
>> | mask3 = icolor( idouble(mask) ); |
>> | idisp(mask3 .* subject); |
>> |
bg = iread('road.png', 'double');
|
>> | bg = isamesize(bg, subject); |
>> | idisp(bg .* (1-mask3)) |
>> >> | idisp( subject.*mask3 + bg.*(1-mask3) ); iprint( bg.*(1-mask3) + subject.*mask3, 'subject_desert'); |
>> | ipixswitch(mask, subject, bg); |
>> | K = ones(21,21) / 21^2; |
>> >> >> >> |
lena = iread('lena.pgm', 'double');
idisp( iconv(K, lena) );
iprint( iconv(K, lena), 'lena_mean_sq'); iprint( lena, 'lena'); |
>> | about(K) |
>> | idisp( ismooth(lena, 5) ) |
>> >> >> >> >> | clf surfl(-15:15, -15:15, K);
h=15;
surfl(-h:h, -h:h, K); colormap(jet); shading faceted; set(gca, 'XLimMode', 'manual', 'Xlim', [-15 15], 'YLimMode', 'manual', 'Ylim', [-15 15])
iprint('kgauss');
|
>> >> >> >> >> | K = kcircle(8, 15);
surfl(-15:15, -15:15, K);
h=15;
surfl(-h:h, -h:h, K); colormap(jet); shading faceted; set(gca, 'XLimMode', 'manual', 'Xlim', [-15 15], 'YLimMode', 'manual', 'Ylim', [-15 15])
iprint('tophat');
|
>> >> >> >> |
castle = iread('castle_sign.jpg', 'double', 'grey');
idisp2(castle); hold on; plot([0,numcols(castle)], [360 360], 'g')
iprint('sign', 'nogrid')
clf
|
>> | p = castle(360,:); |
>> >> >> >> >> >> >> >> >> | plot(p);
xlabel('u (pixels)')
ylabel('pixel value')
iprint('sign_profile')
plot(p, '-*')
xaxis(560,610)
ylabel('pixel value')
xlabel('u (pixels)')
iprint('sign_profile_zoom')
|
>> >> >> >> >> >> >> | plot(diff(p))
plot(diff(p), '-*')
xaxis(560,610)
xlabel('u (pixels)')
ylabel('derivative of grey value')
grid
iprint('sign_diff');
|
>> >> | K = [-0.5 0 0.5]; idisp( iconv(castle, K), 'invsigned') |
>> | Du = ksobel |
>> >> >> | idisp( iconv(castle, Du), 'invsigned') idisp( iconv(castle, Du), 'invsigned', 'nogui') iprint( 'sign_dx' ) |
>> >> >> | idisp( iconv(castle, Du'), 'invsigned') idisp( iconv(castle, Du'), 'invsigned', 'nogui' ) iprint( 'sign_dy' ) |
>> >> | Iu = iconv( castle, kdgauss(2) ); Iv = iconv( castle, kdgauss(2)' ); |
>> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> | clf m = sqrt( Iu.^2 + Iv.^2 );
idisp(m, 'invert', 'nogui');
iprint( 'sign_mag');
clf
surfc(318:408, 550:622, m(318:408,550:622)')
colormap(bone)
shading interp
xlabel('u')
ylabel('v')
ylabel('u')
xlabel('v')
xaxis(318,408)
yaxis(550,622)
zlabel('edge magnitude')
iprint('sign_mag3d');
|
>> | th = atan2( Iv, Iu); |
>> >> >> >> >> | quiver(1:20:numcols(th), 1:20:numrows(th), ... Iv(1:20:end,1:20:end)) xaxis(1280) yaxis(960) iprint( 'sign_quiver'); |
>> >> >> >> | [du,dv] = isobel( castle, kdgauss(2) );
idisp(m, 'invert', 'nogui');
axis([400 700 300 600])
iprint('sign_mag_zoom');
|
>> >> >> >> | edges = icanny(castle, 2); idisp( edges, 'invert', 'nogui'); axis([400 700 300 600]) iprint( 'canny_zoom'); |
>> | L = klaplace() |
>> >> >> >> >> >> >> | lap = iconv( castle, klog(2) );
idisp(lap, 'invsigned', 'nogui');
iprint('laplacian');
r = [550 630; 310 390];
idisp(lap, 'invsigned', 'nogui')
xaxis(r(1,:)); yaxis(r(2,:));
iprint( 'laplacian_zoom');
|
>> >> >> >> | zc = zcross(lap);
idisp(zc, 'nogui', 'invert');
xaxis(r(1,:)); yaxis(r(2,:));
iprint('laplacian_zc_zoom');
|
>> | T = iroi(lena, [240 290; 250 300]); |
>> >> >> | sad(T, T) ssd(T, T) ncc(T, T) |
>> >> | sad(T, T*0.9) ssd(T, T*0.9) |
>> | ncc(T, T*0.9) |
>> >> >> | sad(T, T+0.1) ssd(T, T+0.1) ncc(T, T+0.1) |
>> >> >> | zsad(T, T+0.1) zssd(T, T+0.1) zncc(T, T+0.1) |
>> | zncc(T, T*0.9+0.1) |
>> | S = isimilarity(T, crowd, @zncc); |
>> | idisp(S, 'colormap', 'jet', 'bar') |
>> >> | [p,mx] = peak2(S, 1, 5); mx |
>> >> >> >> >> >> >> >> >> >> >> | idisp(crowd);
idisp(S, 'nogui', 'colormap', 'hsv');
plot_circle(p, 30)
plot_point(p, 'sequence', 'bold', 'textsize', 24, 'textcolor', 'k')
colorbar
iprint('wally_sim');
clf
idisp(crowd, 'nogui');
plot_circle(p, 30, 'fillcolor', 'b', 'alpha', 0.3, 'edgecolor', 'none') plot_point(p, 'sequence', 'bold', 'textsize', 24, 'textcolor', 'k', 'Marker', 'none')
iprint('wally_found', 'nogrid');
|
>> | out = iwindow(lena, 3, 'var'); |
>> | mx = irank(lena, 1, 2); |
>> | med = irank(lena, 12, 2); |
>> >> >> >> >> >> >> | randinit spotty = lena; npix = prod(size(lena)); spotty(round(rand(5000,1)*(npix-1)+1)) = 0; spotty(round(rand(5000,1)*(npix-1)+1)) = 1.0; idisp(spotty) iprint(spotty, 'spotty'); |
>> >> >> | M = ones(3,3); M(2,2) = 0 mxn = irank(lena, 1, M); |
>> | idisp(lena > mxn) |
>> >> >> | eg_morph1 idisp(im) morph2 |
>> | S = ones(5,5); |
>> | mn = imorph(im, S, 'min'); |
>> | S = kcircle(3) |
>> >> >> | opened = iopen(objects, S); closed = iclose(opened, S); iprint(opened, 'colorseg3', 'invert'); |
>> | eroded = imorph(clean, kcircle(1), 'min'); |
>> >> >> >> | skeleton = ithin(clean); im = clean; idisp(skeleton + im*0.3, 'invert'); iprint(skeleton + im*0.3, 'hm-skel', 'invert'); |
>> >> >> >> >> | ends = iendpoint(skeleton);
z = ends + im*0.3 + skeleton*0.2;
idisp(z, 'invert', 'nogui');
axis([203 326 261 358])
iprint('hm-ends');
|
>> >> >> >> >> | joins = itriplepoint(skeleton);
z = joins + im*0.3 + skeleton*0.2;
idisp(z, 'invert', 'nogui');
axis([203 326 261 358])
iprint('hm-triple');
|
>> |
lena = iread('lena.pgm');
|
>> | mouth = iroi(lena, [253, 330; 332, 370]); |
>> >> | bigger = ireplicate( smaller, 7 ); iprint(bigger, 'roof_subsampled_antialiased_zoom'); |
>> | smoother = ismooth( bigger, 4); |
>> >> | smaller = iscale(lena, 0.1); bigger = iscale(smaller, 10); |
>> >> >> >> >> >> >> >> >> >> | p = ipyramid(lena)
im = zeros(512, 992);
w = 1;
for i=1:5,
[nr,nc] = size(p{i});
im(1:nr,w:w+nc-1) = p{i};
w = w + nc;
end
idisp(im, 'square', 'nogui');
iprint('pyramid', 'nogrid')
|
>> | [Ui,Vi] = imeshgrid(lena); |
>> | [Uo,Vo] = imeshgrid(400, 400); |
>> | U = 4*(Uo-100); V = 4*(Vo-200); |
>> >> >> | lena_small = interp2(Ui, Vi, idouble(lena), U, V);
idisp(lena_small, 'nogui', 'square');
iprint('lena_warped', 'nogrid');
|
>> | [Uo,Vo] = imeshgrid(lena); |
>> >> >> >> >> >> | R = se2(0, 0, pi/6); uc = 256; vc = 256; U = R(1,1)*(Uo-uc) + R(2,1)*(Vo-vc) + uc; V = R(1,2)*(Uo-uc) + R(2,2)*(Vo-vc) + vc; lena_rotated = interp2(Ui, Vi, idouble(lena), U, V);
idisp(lena_rotated, 'nogui', 'square')
iprint('lena_warp_rotate', 'nogrid');
|
>> | lena_rotated = irotate(lena, pi/6); |
>> >> >> >> |
distorted = iread('Image18.tif', 'double');
[Ui,Vi] = imeshgrid(distorted);
Uo = Ui; Vo = Vi;
iprint(distorted, 'target_distorted'); |
>> | load bouget |
>> >> | k = kc([1 2 5]); p = kc([3 4]); u0 = cc(1); v0 = cc(2); fpix_u = fc(1); fpix_v = fc(2); |
>> >> | u = (Uo-u0) / fpix_u; v = (Vo-v0) / fpix_v; |
>> | r = sqrt( u.^2 + v.^2 ); |
>> >> >> >> | delta_u = u .* (k(1)*r.^2 + k(2)*r.^4 + k(3)*r.^6) + ... + p(2)*(r.^2 + 2*u.^2); delta_v = v .* (k(1)*r.^2 + k(2)*r.^4 + k(3)*r.^6) + ... + 2*v.^2) + 2*p(1)*u.*v; |
>> | ud = u + delta_u; vd = v + delta_v; |
>> >> | U = ud * fpix_u + u0; V = vd * fpix_v + v0; |