============================== EXERCISE: reduce an image // ---- DEMO > Picture p = new Picture( "/Users/wallingf/Desktop/mountain.jpg" ); > p.show(); > p.exercise01(); > p.repaint(); > p = new Picture( "/Users/wallingf/Desktop/wallingf-250x328.jpg" ); > p.exercise01(); > p.show(); // ---- WHAT'S WRONG? > p = new Picture( "/Users/wallingf/Desktop/wallingf-250x328.jpg" ); > p.exercise01wrong(); > p.show(); ===== SLIDES: Kinds of _Selection_ ** we learn that much of the background has a similar intensity to the shirt - accounts for why *distance* was insufficient when changing shirt color: - background average color is close to the shirt average; shirt distance! ** what could we do differently? > p.explore(); > p = new Picture( "/Users/wallingf/Desktop/wallingf-250x328.jpg" ); > p.changePurpleToKellyGreen(); > p.show(); ===== SLIDES: Kent Beck quote ** Your goal is to have many choices when designing a solution. Think about problems in many different ways... Don't settle for your first thought! ============================== TASK: edge detection * use explorer to walk boundaries on the mountain > p = new Picture( "/Users/wallingf/Desktop/mountain.jpg" ); > p.explore(); * aPixel.getAverage() > p.detectEdges( 25 ); > p.show(); > p = new Picture( "/Users/wallingf/Desktop/wallingf-250x328.jpg" ); > p.detectEdges( 25 ); > p.repaint(); > p = new Picture( "/Users/wallingf/Desktop/wallingf-250x328.jpg" ); > p.detectEdges( 15 ); > p.repaint(); > p = new Picture( "/Users/wallingf/Desktop/sundial.png" ); > p.detectEdges( 25 ); > p.repaint(); > p = new Picture( "/Users/wallingf/Desktop/wheaties-box.jpg" ); > p.detectEdges( 15 ); > p.repaint(); ============================== SLIDES: Computer Vision, Step 1: Find Edges ============================== TASK: highlight extremes, middle ground > import java.awt.Color; > p = new Picture( "/Users/wallingf/Desktop/sundial.png" ); > p.highlightExtremes( 50, Color.blue ); > p.show(); ===== SLIDES: Kinds of _Condition_ ============================== HOMEWORK 2: demo the CODE; discuss * what are the high-level operations? * design: create empty methods, and design the operations one at a time > Picture mainImage=new Picture("/Users/wallingf/Desktop/wallingf-500x656.jpg"); > mainImage.show(); > Picture imageToEmbed = new Picture( "/Users/wallingf/Desktop/insano.jpg" ); > imageToEmbed.show(); > imageToEmbed Picture, filename /Users/wallingf/Desktop/insano.jpg height 231 width 239 > mainImage.embedImage( imageToEmbed, 5, 5, 220 ); > mainImage.repaint(); ============================== HOMEWORK 3: demo the RESULTS; discuss > p = new Picture( "/Users/wallingf/Desktop/sundial.png" ); > p = p.lakeEffect(); > p.show(); > p = new Picture( "/Users/wallingf/Desktop/beach.jpg" ); > p.fogEffect( 150 ); > p.repaint(); > p = new Picture( "/Users/wallingf/Desktop/beach.jpg" ); > p.fogEffect( 100 ); > p.repaint(); * what are the high-level operations? * design: create empty methods, and design the operations one at a time