From 4975384c6b5495ee0ed96ba0c427cd43e300ce9e Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Fri, 11 Feb 2022 18:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=9C=E6=96=B0=E5=A2=9E=E4=BA=86=E2=80=9CIm?= =?UTF-8?q?ageSaver.php=E2=80=9D=E3=80=81=E2=80=9CLightStrategy.php?= =?UTF-8?q?=E2=80=9D=E3=80=81=E2=80=9CFileSaver.php=E2=80=9D=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E7=B1=BB=E6=96=87=E4=BB=B6=EF=BC=8C=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E7=B1=BB=E6=96=87=E4=BB=B6=E7=A8=8D=E6=9C=89=E5=B0=8F=E6=94=B9?= =?UTF-8?q?=E5=8A=A8=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/print.php | 11 +++++++++-- src/scene/BaseCfg.php | 6 +++--- src/scene/FileSaver.php | 20 ++++++++++++++++++++ src/scene/Film.php | 9 ++++----- src/scene/Filter.php | 5 ++--- src/scene/ImageSaver.php | 21 +++++++++++++++++++++ src/scene/LightStrategy.php | 16 ++++++++++++++++ src/scene/Metropolis.php | 1 - src/scene/NoiseEstimation.php | 1 - src/scene/Path.php | 1 + src/scene/Random.php | 1 - src/scene/Sampler.php | 5 ----- src/scene/Sobol.php | 1 - src/utils/StringHelper.php | 12 +++++++++++- 14 files changed, 87 insertions(+), 23 deletions(-) create mode 100644 src/scene/FileSaver.php create mode 100644 src/scene/ImageSaver.php create mode 100644 src/scene/LightStrategy.php diff --git a/examples/print.php b/examples/print.php index 061fd88..06e5021 100644 --- a/examples/print.php +++ b/examples/print.php @@ -27,13 +27,20 @@ echo $path; $sampler = new Sampler(['imagemutationrate' => 0.888]); $sampler->random->overlapping = 32; echo $sampler; + + +$lightStrategy = new LightStrategy(); +echo $lightStrategy; + */ +$filesaver = new FileSaver(); + +echo $filesaver; -$film = new Film(); -echo "$film\n"; +$film = new Film(); $film->outputs[3]['index'] = '中国最牛'; echo $film; diff --git a/src/scene/BaseCfg.php b/src/scene/BaseCfg.php index 9191c71..b6989d2 100644 --- a/src/scene/BaseCfg.php +++ b/src/scene/BaseCfg.php @@ -30,7 +30,6 @@ class BaseCfg extends Base $object = new \ReflectionClass($this); $properties = $object->getProperties(); - //var_dump($properties); //获取类名 -> 去除命名空间 -> 转成全小写 @@ -40,6 +39,7 @@ class BaseCfg extends Base $className = "{$parentClassName}.$className"; } + $ret = ""; foreach ($properties as $item) { @@ -51,7 +51,7 @@ class BaseCfg extends Base $name = implode(".", array_map('strtolower', StringHelper::camelStrToArray($name))); $value = $item->getValue($this); - if (is_string($value)) + if (is_string($value)) { $ret .= "{$className}.{$name} = \"{$value}\"\n"; } @@ -64,7 +64,7 @@ class BaseCfg extends Base $value = $value ? 1 : 0; $ret .= "{$className}.{$name} = {$value}\n"; } - else if (is_object($value) && $value instanceof BaseCfg) + else if (is_object($value) && $value instanceof BaseCfg) { $ret .= $value->toString($className); } diff --git a/src/scene/FileSaver.php b/src/scene/FileSaver.php new file mode 100644 index 0000000..e6b3bf9 --- /dev/null +++ b/src/scene/FileSaver.php @@ -0,0 +1,20 @@ + diff --git a/src/scene/Film.php b/src/scene/Film.php index 81a274d..dcf51c4 100644 --- a/src/scene/Film.php +++ b/src/scene/Film.php @@ -54,12 +54,12 @@ class Film extends BaseCfg public function __construct($config = []) { $this->noiseEstimation = new NoiseEstimation($config); - $this->filter = new Filter($config); + //$this->filter = new Filter($config); $this->imagepipelines = array( '000' =>array( '0' => array( - 'type' => "NOP", + new Filter($config), ), '1' => array( 'type' => "TONEMAP_LINEAR", @@ -106,9 +106,8 @@ class Film extends BaseCfg ) ) ) - ); - - + ); + $this->outputs = array( '0' => array( 'type' => 'RGB_IMAGEPIPELINE', diff --git a/src/scene/Filter.php b/src/scene/Filter.php index f9222ff..e8f1ab2 100644 --- a/src/scene/Filter.php +++ b/src/scene/Filter.php @@ -1,7 +1,6 @@ toString()) as $value ) + { + if(!empty($value))$retStr[] = $value; + } + } else { - $retStr[] = "{$key} = {$value}"; + $retStr[] = "{$key} = {$value}"; } } return $retStr;