1. In the Steganography class, after modifying canHide to allowthe secret image to be smaller than the source image, write asecond version of the hidePicture method that allows the user toplace the hidden picture anywhere on the modified picture. Thismeans adding two parameters for startRow and startColumn thatrepresent the row and column of the upper left corner where thehidden picture will be placed. Sample code: Picture beach = newPicture("beach.jpg"); Picture robot = new Picture("robot.jpg");Picture flower1 = new Picture("flower1.jpg"); beach.explore(); //these lines hide 2 pictures Picture hidden1 = hidePicture(beach,robot, 65, 208); Picture hidden2 = hidePicture(hidden1, flower1,280, 110); hidden2.explore(); Picture unhidden =revealPicture(hidden2); unhidden.explore(); Results: hidden 2 WithPictures Hidden: unhidden After Calling revealPicture: Zoom ColumColu R26 4B 3 Coloration R 25 GOB 19
2. Write a method findDifferences that takes two pictures andmakes a list of the coordinates that are different between them(returns an ArrayList of points/coordinates). Sample code: Picturearch = new Picture("arch.jpg"); Picture koala = newPicture("koala.jpg"); Picture robot1 = new Picture("robot.jpg");ArrayList pointList = findDifferences(arch, arch2);System.out.println("PointList after comparing two identicalpictures " + "has a size of " + pointList.size()); pointList =findDifferences(arch, koala); System.out.println("PointList aftercomparing two different sized pictures " + "has a size of " +pointList.size()); Picture arch2 = hidePicture(arch, robot1, 65,102); pointList = findDifferences(arch, arch2);System.out.println("Pointlist after hiding a picture has a size of" + pointList.size()); arch.show(); arch2.show(); Results:PointList after comparing two identical pictures has a size of 0PointList after comparing two different sized pictures has a sizeof 0 PointList after hiding a picture has a size of 2909
3. Write a method showDifferentArea that takes a picture and anArrayList and draws a rectangle around part of picture that isdifferent (returns a Picture). Tip To provide instructions for thecomputer to process many different input values, selectionstatements may need to be nested together to form more than twobranches and options. Pathways can be broken down into a series ofindividual selection statements based on the conditions that needto be checked and nesting together the conditions that should onlybe checked when other conditions fail or succeed. Sample code:Picture hall = new Picture("femaleLionAndHall.jpg"); Picture robot2= new Picture("robot.jpg"); Picture flower2 = newPicture("flower1.jpg"); // hide pictures Picture hall2 =hidePicture(hall, robot2, 50, 300); Picture hall3 =hidePicture(hall2, flower2, 115, 275); hall3.explore();if(!isSame(hall, hall3)) { Picture hall4 = showDifferentArea(hall,findDiffferences(hall, hall3)); hall4.show(); Picture unhiddenHall3= revealPicture(hall3); unhiddenHall3.show(); } Results: BoundingRectangle Unhidden Pictures Line Can anyone do it?
1. In the Steganography class, after modifying canHide to allow the secret image to be smaller than the source image, wr
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am