1 / 31

CS 585 Computational Photography

CS 585 Computational Photography. Nathan Jacobs. Administrivia. project 1: due Tuesday before midnight. Overview. point processing morphological operations more useful Matlab functions. Point Processing.

nasia
Download Presentation

CS 585 Computational Photography

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 585 Computational Photography Nathan Jacobs

  2. Administrivia • project 1: due Tuesday before midnight

  3. Overview • point processing • morphological operations • more useful Matlab functions

  4. Point Processing • The simplest kind of range transformations are these independent of position x,y: g(x,y) = h(f(x,y)) • Important: unlike convolution/correlation, no looping over nearby pixels • Important: every pixel for himself – spatial information completely lost! • can’t blur • can’t compute derivatives

  5. Negative

  6. Basic Point Processing

  7. Power-law transformations

  8. Image Enhancement

  9. Camera Block Diagram Szeliski

  10. Contrast Stretching

  11. Image Histograms Which one is which? Cumulative Histograms

  12. Histogram Equalization

  13. How do you do this in Matlab? • negative image • power-law transformation • contrast stretching • histogram equalization imOut = 1 - imIn imOut = interp1([0 .25 .75 1], [0 .1 .9 1], imIn, 'linear') imOut = histeq(imIn, hgram) (can also use histogram, cumulative histogram, and contrast stretching)

  14. Limitations of Point Processing • Q: What happens if I reshuffle all pixels within the image? • A: It’s histogram won’t change. No point processing will be affected…

  15. Morphological Operation • What if your images are binary masks? • Binary image processing is a well-studied field, based on set theory, called Mathematical Morphology

  16. Preliminaries

  17. Preliminaries

  18. Dilation and Erosion • Two basic operations: • A is the image, B is the “structural element”, a mask akin to a kernel in convolution • Dilation : all shifts of B that have a non-empty overlap with A • Erosion : all shifts of B that are fully contained within A)

  19. Dilation

  20. Dilation

  21. Erosion

  22. Erosion Original image Eroded image

  23. Erosion Eroded once Eroded twice

  24. Opening and Closing • Opening : (erode, then dilate) • Closing : (dilate, then erode) • Prove to yourself that they are not the same thing. Play around with imdilate,imerodeand bwmorph in Matlab. • smoothes the contour of an object, breaks narrow isthmuses, and eliminates thin protrusions • smooth sections of contours but, as opposed to opening, it generally fuses narrow breaks and long thin gulfs, eliminates small holes, and fills gaps in the contour

  25. Opening and Closing

  26. Opening and Closing OPENING: The original image eroded twice and dilated twice (opened). Most noise is removed CLOSING: The original image dilated and then eroded. Most holes are filled.

  27. Boundary Extraction Difference between image and erosion by a 3x3 mask of ones im = ~imread('http://petticoatsandpistols.com/wp-content/uploads/2009/02/silhouette11.bmp') imshow(xor(im, imerode(im, true(3))))

  28. Connected Components im = ~~rgb2gray(im2double(imread('media/text.png'))); CC = bwlabel(im); figure; imagesc(CC) regions = regionprops(im); [regions.Area] % show area of each conn. component

  29. some usefulMatlab functions • linspace: make linearly spaced samples • sub2ind, ind2sub: from 1D to ND indexing • bwdist: computes distance from positives in a binary image • regionprops: compute properties of connected components • find: find non-zeros, (can also find first k or find last k) • repmat: replicate a matrix • reshape: reshape a matrix • interp1: many types of interpolation • ndgrid: make array of indices of pixels • zeros, ones, rand, randn, blkdiag: matrix construction http://home.online.no/~pjacklam/matlab/doc/mtt/index.html

  30. Conclusion • point processing • morphological operations

  31. Next Time

More Related