当前位置:天才代写 > app代写,ios代写,手机软件代写-100%原创,免费修改 > program代写 程序代写 project代写 code代写

program代写 程序代写 project代写 code代写

2020-08-06 16:52 星期四 所属: app代写,ios代写,手机软件代写-100%原创,免费修改 浏览:1027

program代写

program代写 This project adopts the object-oriented principle, slightly changed the Image class, and implemented a Manipulator class.

program代写
program代写

1.Description

This project adopts the object-oriented principle, slightly changed the Image class, and implemented a Manipulator class. The main functions are encapsulated in the class.program代写

The image read in the constructor is saved in the member variable “img_”, and all subsequent operations on this image generate a copy of this member variable and write it to a new file. When the program operates the picture, it does not affect other operations.

Class diagram is as follows.

program代写
program代写

2.Pseudocode

2.1 Show R/G/B channels

 

  Image channel_filter(Image img, Channel channel):

      tmp_img = img

  for i from 0 to (tmp_img.w * tmp_ing.h):

      if channel == Red:

            tmp_img[i] *= kRed

        else if channel == Green:

            tmp_img[i] *= kGreen

        else if channel == Blue:

            tmp_img[i] *= kBlue

    return tmp_img

2.2 Change brightness

Image img_lighter(Image img, float light_rate):

      tmp_img = img

      for i from 0 to (tmp_img.w * tmp_ing.h):

          Rgb rate = Rgb(1 + light_rate, 1 + light_rate, 1 + light_rate)

          tmp_img[i] *= rate

          if (tmp_img[i].r > 1)

              tmp_img[i].r = 1;

          if (tmp_img[i].g > 1)

              tmp_img[i].g = 1;

          if (tmp_img[i].b > 1)

              tmp_img[i].b = 1;

          if (tmp_img[i].r < 0)

              tmp_img[i].r = 0;

          if (tmp_img[i].g < 0)

              tmp_img[i].g = 0;

          if (tmp_img[i].b < 0)

              tmp_img[i].b = 0;

    return tmp_img

3.Results

3.1 Select file

a
a

3.2 Show red channel

b
b
1
1

3.3 Show green channel

c
c
2
2

3.4 Show blue channel

d
d
3
3

3.5 Brightness increases by 0.2

program代写
program代写
4
4

3.6 Brightness decreases by 0.3

program代写
program代写
5
5

4.Analysis

This program basically implements the requirements mentioned in the documentation, but there are a few points that can be optimized. First, you can reimplement the Image class. Using C-style dynamic arrays as members of a class has drawbacks, especially when copying objects. Re-implementing it to the style of the stl template library avoids this inconvenience. In addition, the member variable property in the Image class is public, which does not conform to the encapsulation of the class. It is best to change its property to private and implement the get and set methods.program代写

更多其他:数据库代写 matlab代写 app代写 数学代写 CS代写  代写CS作业 数据分析代写 程序代写 程式代写 算法代写

合作平台:天才代写 幽灵代写  写手招聘 Essay代写

 

天才代写-代写联系方式