0
Hey Family,i need help . how can create folders on c# visual studio
C# learning
5 Antworten
+ 2
using System.IO;
Directory.CreateDirectory("directory");
0
C# Visual Studio? In your project? Or in Code?
0
Project
0
Consider the code below carefully and then answer Q.1.
public BufferedImage processImage(BufferedImage img){
int height =img.getHeight();
int width = img.getWidth();
int i,k;
for(i =0;i<width;i++){
for(k=0;k<height;k++){
Color old = new Color(img.getRGB(i, k));
int r = (int)(old.getRed()*0.25);
int gr = (int)(old.getGreen()*0.5);
int b = (int)(old.getBlue()*0.25);
Color nw=new Color(r+gr+b,r+gr+b,r+gr+b);
img.setRGB(i, k, nw.getRGB()); }}
return img;
}
Q. 1
a) What does the code above do? Why do you say so? (5 marks)
b) What would be the effect of changing the co-efficients 0.25,0.5 and 0.25 to 0.1, 0.6 and 0.3 in the code above? (5marks)
c) Image negatives are a form of point/pixel based image processing. Given an RGB pixel with the value (128,75,180), What would the RGB pixel value be if its negated? (5 marks)
0
I don't tested it, but i think next:
a) this method change color of all pixels in img on color that create in this line "Color nw = new Color(....)"
b) if you change coefficientes - you change saturation of color. But you must be cearful with it, if sum of color coefficient will bee more than 1 - it call exception , cause color channel is byte, and after sum it might've be more than 255.
c) i find only one formula to negate img "G=(R+G+B)/3". And we must change RGB style to GrayScale. So if we paste values we get next G = (128+75+180)/3 = ~ 128