1 / 48

Homework Due

Explore how computer vision can improve tasks, feasibility of implementation, and essential camera job aspects. Understand camera projection methods and vanishing points. Learn about perspective and orthographic projection and camera calibration techniques. Dive into image representation and file storage formats for efficient processing.

agooding
Download Presentation

Homework Due

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. Homework Due CSC508

  2. Homework • Describe a task that you think might benefit from computer vision. • How is the task currently performed? • How could computer vision make it better? • Do you think it’s feasible to implement? CSC508

  3. Image Formation CSC508

  4. Image Formation • First photograph due to Niepce – 1822 • Now: various films and digital (CCD, CMOS) • “Spectrum” of parameters CSC508

  5. The Camera’s Job • Basically, the job of the camera (no matter what the format) is mapping the 3D world onto a 2D plane • Yes, even a 3D camera does this…it just does it twice • The operation is called a “projection” • There are two projections that we study/utilize • Perspective • Orthographic CSC508

  6. Perspective Projection • Size of the object on the image plane is dependent on the distance of the object from the image plane CSC508

  7. Perspective Projection • Parallel lines in the scene intersect at the horizon on the image plane CSC508

  8. Vanishing Points • Sets of parallel lines meet at a different points (for a given direction) • The vanishing point for this direction • Sets of parallel lines on the same plane lead to collinear vanishing points. • The line is called the horizon for that plane • An easy way to spot poorly faked images CSC508

  9. Vanishing Points CSC508

  10. Equation of Perspective Projection Image Plane Real Object Lens Center • (x, y, z) -> (f x/z, f y/z, -f) (by considering similar triangles – simple geometry) • We ignore the 3rd coordinate since all image points are in the image plane • Multiple real objects will map to the same image point • Why is that last point important? CSC508

  11. Accuracy • Most of computer vision is geared towards recognizing an object within a scene • For these applications, general knowledge of the perspective projection is enough • Some applications use computer vision to make measurements • For these applications accuracy is required • Therefore, we must calibrate the camera system (lens, image plane) CSC508

  12. Camera Parameters • Optical axis relative to the image plane • Angle between optical axis and image plane • Focal length of the lens • Size of the pixels in the image plane • Position of camera in real world • Orientation of camera in real world CSC508

  13. Camera Calibration • Through the use of appropriate target scenes and test set ups all these parameters can be derived • Once derived, images can be compensated based on parameters thus creating a measurement device CSC508

  14. Camera Calibration • We know where the grid points are (relative to one another) • We know where the camera is (relative to the grid points) • Thus, we know where the [image of] the grid points should lie in the image plane • We can create calibration factors based on where they should lie and where they actually lie in the image plane • Search web for “Roger Tsai” and “Camera Calibration” for details • It’s very math-intensive CSC508

  15. Orthographic Projection • If the camera is far from the objects relative to the depth (height?) of the objects • i.e. distance from scene objects to camera is constant (flat scenes) • Provides an approximation of the perspective projection • Sometimes useful for simplifying various algorithms where depth is not a concern • Overhead aerial (air to ground) applications CSC508

  16. Orthographic Projection Image Plane Real Object Lens Center CSC508

  17. Orthographic Projection • Aerial image CSC508

  18. Lens • For our purposes the lens will • Provide a means of focus • Provide a means for more efficient light ray capture • We won’t go into the mathematics of lens design here – that’s better covered in a physics course CSC508

  19. Image Representation • Two dimensional array of values • Typically byte or integer (unsigned) • When performing operations you must do range checking • Each array location is referred to as a pixel • Short for “picture element” • Height and width of the array determine the image’s spatial resolution • Bit depth of each pixel determines the intensity resolution • 8-bit image – each pixel is in the range of 0..255 • If it’s greater than 8 you must scale it prior to display as most monitors can only display 256 gray levels • 24-bit color images are merely three 8-bit color images “stacked” together CSC508

  20. File Storage • There are many image file formats in use today • jpg –JPEG • png – portable network graphics • tiff – tagged image file format • j2k – JPEG 2000 • raw – no meta-data, just image data • gif – graphics interchange format • bmp – bitmap CSC508

  21. File Storage • Differences include • Compressed vs. uncompressed • Inclusion of image meta-data • Inclusion of device meta-data • Inclusion of processing meta-data • Allowable bit depth • etc. CSC508

  22. 24-Bit BMP File Formatan example • Bitmap file header • Data structure that tells the reader that it is a BMP file • Bitmap information header • Data structure that tells the reader the format of the image • Image data • The picture elements (pixels) that make up the picture CSC508

  23. Bitmap File Header Fields • bfType – 2 bytes, always set to ‘B’ and ‘M’ • bfSize – 4 bytes, size of the file in bytes (file header + image header + pixels) • bfReserved1 – 2 bytes, reserved for future usage • bfReserved2 – 2 bytes, reserved for future usage • bfOffBits – 4 bytes, number of bytes in file before image starts (file header + image header) CSC508

  24. Bitmap Information Header Fields • biSize – 4 bytes, size in bytes of this structure (40) • biWidth – 4 bytes (signed), number of pixels per row • biHeight – 4 bytes (signed), number of rows per image • biPlanes – 2 bytes, number of image planes (1) • biBitCount – 2 bytes, number of bits per pixel (24) • biCompression – 4 bytes, type of compression (0) • biSizeImage – 4 bytes, number of pixels in the file • Not always (biWidth * biHeight * 3) because image rows must be a multiple of 4 bytes (to support fast transfer on a 32-bit bus) • biXPelsPerMeter – 4 bytes (signed), for printer usage (ignore) • biYPelsPerMeter – 4 bytes (signed), for printer usage (ignore) • biClrUsed – 4 bytes, number of colors actually used in images with less than 24 bits per pixel (0) • biClrImportant – 4 bytes, number of “important” colors in images with less than 24 bits per pixel (0) CSC508

  25. Bitmap File Image Data • Pixels are stored in Blue-Green-Red order • Rows of pixels must be multiples of 4 bytes • Bottom row of image is stored first, top row is stored last • i.e. image is stored upside down CSC508

  26. BMP File Writer • I can place code to read/write BMP and raw files on the class website • Both Java and C++ versions can be there • If you want VB (or anything else) you’ll have to study the code Java or C++ code and make your own • They may not be the most efficient but they work • For those of you writing in Java, a better solution is to use the ImageIO class or write ImageJ plugins • The popular image formats are supported for read and write CSC508

  27. Preprocessing CSC508

  28. Histogram Distribution of pixel intensities One dimensional array of integers Size of the array is directly related to the pixel resolution Intensity Histogram CSC508

  29. Contrast Enhancement • Histogram Stretch • Compute the image histogram • Specify dark and bright cut-off points • This is usually done percentiles of the distribution – then converted to actual intensity cutoffs • Alternatively, may be specified as two fixed intensity cutoffs • For each pixel I(i, j) compute: CSC508

  30. Percentiles to Intensity Cutoffs Count pixels in histogram bins until you reach the desired percentile values to get the two cutoff points CSC508

  31. Contrast Enhancement CSC508

  32. Resultant Histogram Note: The scale on the vertical axis has changed due to the display program The high frequency bumps are due to the multiply operation CSC508

  33. Before/After Comparison CSC508

  34. Contrast Enhancement • Why do we want to do this? • Because contrast enhancement will bring out some features and suppress others • The problem is that it’s not easy to control • Basically, it’s an operation that is more for human consumption than computer vision • We study it as an introduction to the histogram CSC508

  35. if then Contrast Enhancement • Binarize/Threshold • Choose a threshold • Perform the following [parallel] operation on every pixel • The result is a 1-bit image (represented in 8-bits for display) CSC508

  36. Binarize/Threshold CSC508

  37. Noise Reduction • Median Filter • Define a neighborhood around every pixel • Should be odd dimensions (but not absolutely necessary) • For every pixel I(i, j) • Numerically sort the pixel values in the neighborhood • Replace I(i, j) with the median (middle) value of the sorted neighborhood • The result is the removal of “salt and pepper” artifacts • Note that this operation is parallel in that all pixels perform their operation simultaneously • So, how do you do this on a sequential machine? CSC508

  38. Little spots – trust me Median Filter CSC508

  39. Noise Reduction • Outlier Filter • Define a neighborhood around every pixel • Should be odd dimensions (but not absolutely necessary) • For every pixel I(i, j) • Compute the average pixel value of the neighborhood, n(i, j) • If |I(i, j)- n(i, j)| > threshold then replace I(i, j) with the neighborhood average • Result will be sensitive to the selected threshold • The result is the removal of “salt and pepper” artifacts • Note that this operation is parallel in that all pixels perform their operation simultaneously CSC508

  40. Gaussian Filter • Width is the number of pixels covered by the filter • Sigma is the standard deviation of the Gaussian curve in pixels CSC508

  41. Gaussian Filter • Sigma 1.0, Filter Width 7 CSC508

  42. Gaussian Filter • Sigma 1.6, Filter Width 7 CSC508

  43. Gaussian Filter • Sigma 1.6, Filter Width 15 CSC508

  44. Gaussian is Separable • Two 1D Gaussians produces the same results a one 2D Gaussian • Filter horizontally first • Filter horizontal results vertically second • This speeds things up dramatically CSC508

  45. Gaussian Filter – 1D CSC508

  46. Gaussian Filter – 1D • Sigma 1.6, Filter Width 15 CSC508

  47. Gaussian Filter • How do we use the Gaussian Filter? • Convolution – which we’ll talk about next week CSC508

  48. Things To Do • Programming homework assignment • Histogram Stretch • Binarization • Median Filter • Outlier Filter • You may write in any programming language you choose • Deliverables: • Live demonstration of your code to me (if this is feasible) • Email the source code to reinhart@clunet.edu with the subject line CSC508 PROGRAM 1 • Due next week beginning of class • (late assignments will be penalized 10%) • I will post test images • Reading for Next Week • Chapter 8 – Edge Detection CSC508

More Related