forked from satu0king/ImageProcessing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoise.cpp
More file actions
33 lines (33 loc) · 638 Bytes
/
noise.cpp
File metadata and controls
33 lines (33 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<iostream>
#include"Image.h"
#include"Pixel.h"
#include"Color.h"
#include"noise.h"
using namespace std;
noise::noise(int w,int h):
Image(w,h)
{
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
int r=rand()%256;
int g=rand()%256;
int b=rand()%256;
Color *c=new Color(r,g,b);
set_color(i,j,*c);
}
}
}
noise::~noise(){
//empty
}
noise::noise(const noise &n):
Image(n){
//empty
}
void noise::compositemage(Image img2,float alpha){
for (int i = 0; i<_width; i++) {
for (int j = 0; j<_height; j++) {
_img[i][j].applyFilter(img2.color(i,j),alpha);
}
}
}