Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- image = new SimpleImage("flowers.jpg");
- width = image.getWidth();
- height = image.getHeight();
- // Tăng vòng lặp lên để tăng độ nhiễu
- for (i = 0; i < 10000; i++) {
- x = Math.floor(Math.random() * (width - 1));
- y = Math.floor(Math.random() * (height - 1));
- pixel = image.getPixel(x, y);
- pixel.setRed(255);
- pixel.setGreen(255);
- pixel.setBlue(255);
- }
- for (i = 0; i < 10000; i++) {
- x = Math.floor(Math.random() * (width - 1));
- y = Math.floor(Math.random() * (height - 1));
- pixel = image.getPixel(x, y);
- pixel.setRed(255);
- pixel.setGreen(0);
- pixel.setBlue(0);
- }
- for (i = 0; i < 10000; i++) {
- x = Math.floor(Math.random() * (width - 1));
- y = Math.floor(Math.random() * (height - 1));
- pixel = image.getPixel(x, y);
- pixel.setRed(0);
- pixel.setGreen(0);
- pixel.setBlue(255);
- }
- print(image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement