ハッシュのコピー

ハッシュ全体を表す記号は%なので、%で始まるハッシュオブジェクトを代入するだけでハッシュをコピーできる。

ハッシュをコピーする | まくまくPerlノート

ハッシュをコピーして、コピー元もコピー先も中身をいじる。

$ vi hash.pl
$ perl hash.pl
value1
value2
value3
value1
value2
value3

value1
value4
value3
value1
value2
value5
$

互いに影響しあってないので、コピーできてるといえる。

Sample/perl/hash/copy/src/hash at master · bg1bgst333/Sample · GitHub

imshow

OpenCVは、オープンソースのコンピュータビジョンライブラリ。

OpenCV
ユーザインタフェース — opencv v2.1 documentation
OpenCVのインストール方法(Linux)
IDEを使わずにOpenCVを使ったC++ソースファイルをビルドする - Qiita

imshowで画像を表示する。

$ yum search opencv
============================ 名前 完全一致: opencv =============================
opencv.i686 : Collection of algorithms for computer vision
opencv.x86_64 : Collection of algorithms for computer vision
=========================== 概要 & 名前 一致: opencv ===========================
opencv-core.i686 : OpenCV core libraries
opencv-core.x86_64 : OpenCV core libraries
opencv-contrib.i686 : OpenCV contributed functionality
opencv-contrib.x86_64 : OpenCV contributed functionality
frei0r-plugins-opencv.x86_64 : Frei0r plugins using OpenCV
libfreenect-opencv.i686 : OpenCV bindings for libfreenect
libfreenect-opencv.x86_64 : OpenCV bindings for libfreenect
python2-opencv.x86_64 : Python2 bindings for apps which use OpenCV
python3-opencv.x86_64 : Python3 bindings for apps which use OpenCV
opencv-devel.i686 : Development files for using the OpenCV library
opencv-devel.x86_64 : Development files for using the OpenCV library
============================== 名前 一致: opencv ===============================
opencv-doc.noarch : docs files
============================== 概要 一致: opencv ===============================
php-facedetect.x86_64 : PHP extension to access the OpenCV library
waifu2x-converter-cpp.i686 : Image Super-Resolution for Anime-style art using
                           : OpenCL and OpenCV
waifu2x-converter-cpp.x86_64 : Image Super-Resolution for Anime-style art using
                             : OpenCL and OpenCV
$

まず、"opencv"で検索するとそれなりに。

$ sudo yum install opencv-devel
[sudo] bg1 のパスワード:
メタデータの期限切れの最終確認: x:xx:xx 時間前の xxxx年xx月xx日 xx時xx分xx秒 に実施しました。
依存関係が解決しました。
================================================================================
 パッケージ                    アーキテクチャー
                                         バージョン            リポジトリ サイズ
================================================================================
インストール:
 opencv-devel                  x86_64    3.4.1-6.fc29          fedora     881 k
依存関係をインストール中:
 armadillo                     x86_64    9.600.6-1.fc29        updates     27 k
 coin-or-CoinUtils             x86_64    2.10.14-2.fc29        updates    511 k
 gdal-libs                     x86_64    2.3.2-1.fc29          updates    7.2 M
 libaec                        x86_64    1.0.4-1.fc29          updates     35 k
 libva                         x86_64    2.4.1-1.fc29          updates     80 k
 mariadb-connector-c           x86_64    3.1.5-1.fc29          updates    196 k
 mariadb-connector-c-config    noarch    3.1.5-1.fc29          updates     11 k
 postgresql-libs               x86_64    10.10-1.fc29          updates    255 k
 unixODBC                      x86_64    2.3.7-2.fc29          updates    410 k
 uriparser                     x86_64    0.9.3-1.fc29          updates     58 k
 CharLS                        x86_64    1.0-17.fc29           fedora      68 k
 SuperLU                       x86_64    5.2.1-5.fc29          fedora     171 k
 arpack                        x86_64    3.5.0-6.fc28          fedora     195 k
 blas                          x86_64    3.8.0-10.fc29         fedora     418 k
 cfitsio                       x86_64    3.450-2.fc29          fedora     562 k
 coin-or-Clp                   x86_64    1.16.10-6.fc28        fedora     956 k
 coin-or-Osi                   x86_64    0.107.8-8.fc29        fedora     310 k
 freexl                        x86_64    1.0.5-2.fc29          fedora      35 k
 gdcm                          x86_64    2.8.4-10.fc29         fedora     1.6 M
 geos                          x86_64    3.6.1-10.fc29         fedora     607 k
 hdf5                          x86_64    1.8.20-4.fc29         fedora     1.8 M
 lapack                        x86_64    3.8.0-10.fc29         fedora     8.6 M
 libdap                        x86_64    3.19.1-2.fc29         fedora     673 k
 libdc1394                     x86_64    2.2.2-11.fc29         fedora     122 k
 libgeotiff                    x86_64    1.4.0-14.fc29         fedora     707 k
 libgta                        x86_64    1.0.7-8.fc29          fedora      37 k
 libkml                        x86_64    1.3.0-14.fc29         fedora     364 k
 libspatialite                 x86_64    4.3.0a-9.fc29         fedora     2.6 M
 libucil                       x86_64    0.9.10-17.fc29        fedora      72 k
 libunicap                     x86_64    0.9.12-22.fc29        fedora     124 k
 minizip                       x86_64    1.2.11-14.fc29        fedora      29 k
 netcdf                        x86_64    4.4.1.1-10.fc29       fedora     737 k
 ogdi                          x86_64    3.2.1-2.fc29          fedora     275 k
 openblas-openmp               x86_64    0.3.3-2.fc29          fedora     4.6 M
 openblas-threads              x86_64    0.3.3-2.fc29          fedora     4.5 M
 openblas-threads64_           x86_64    0.3.3-2.fc29          fedora     4.5 M
 opencv                        x86_64    3.4.1-6.fc29          fedora     1.6 M
 opencv-contrib                x86_64    3.4.1-6.fc29          fedora     3.7 M
 opencv-core                   x86_64    3.4.1-6.fc29          fedora     4.2 M
 openni                        x86_64    1.5.7.10-13.fc29      fedora     422 k
 proj                          x86_64    4.9.3-6.fc29          fedora     230 k
 tinyxml                       x86_64    2.6.2-17.fc29         fedora      56 k
 xerces-c                      x86_64    3.2.2-1.fc29          fedora     953 k

トランザクションの概要
================================================================================
インストール  44 パッケージ

ダウンロードサイズの合計: 55 M
インストール済みのサイズ: 265 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード中です:
(1/44): armadillo-9.600.6-1.fc29.x86_64.rpm      11 kB/s |  27 kB     00:02    
(2/44): coin-or-CoinUtils-2.10.14-2.fc29.x86_64 159 kB/s | 511 kB     00:03    
(3/44): libaec-1.0.4-1.fc29.x86_64.rpm           20 kB/s |  35 kB     00:01    
(4/44): libva-2.4.1-1.fc29.x86_64.rpm            61 kB/s |  80 kB     00:01    
(5/44): gdal-libs-2.3.2-1.fc29.x86_64.rpm       1.5 MB/s | 7.2 MB     00:04    
(6/44): mariadb-connector-c-config-3.1.5-1.fc29  13 kB/s |  11 kB     00:00    
(7/44): mariadb-connector-c-3.1.5-1.fc29.x86_64 147 kB/s | 196 kB     00:01    
(8/44): postgresql-libs-10.10-1.fc29.x86_64.rpm 152 kB/s | 255 kB     00:01    
(9/44): uriparser-0.9.3-1.fc29.x86_64.rpm        69 kB/s |  58 kB     00:00    
(10/44): unixODBC-2.3.7-2.fc29.x86_64.rpm       204 kB/s | 410 kB     00:02    
(11/44): CharLS-1.0-17.fc29.x86_64.rpm           66 kB/s |  68 kB     00:01    
(12/44): SuperLU-5.2.1-5.fc29.x86_64.rpm         87 kB/s | 171 kB     00:01    
(13/44): arpack-3.5.0-6.fc28.x86_64.rpm         175 kB/s | 195 kB     00:01    
(14/44): blas-3.8.0-10.fc29.x86_64.rpm          212 kB/s | 418 kB     00:01    
(15/44): coin-or-Clp-1.16.10-6.fc28.x86_64.rpm  614 kB/s | 956 kB     00:01    
(16/44): cfitsio-3.450-2.fc29.x86_64.rpm        329 kB/s | 562 kB     00:01    
(17/44): coin-or-Osi-0.107.8-8.fc29.x86_64.rpm  186 kB/s | 310 kB     00:01    
(18/44): freexl-1.0.5-2.fc29.x86_64.rpm          19 kB/s |  35 kB     00:01    
(19/44): gdcm-2.8.4-10.fc29.x86_64.rpm          862 kB/s | 1.6 MB     00:01    
(20/44): geos-3.6.1-10.fc29.x86_64.rpm          322 kB/s | 607 kB     00:01    
(21/44): hdf5-1.8.20-4.fc29.x86_64.rpm          772 kB/s | 1.8 MB     00:02    
(22/44): libdap-3.19.1-2.fc29.x86_64.rpm        468 kB/s | 673 kB     00:01    
(23/44): libgeotiff-1.4.0-14.fc29.x86_64.rpm    444 kB/s | 707 kB     00:01    
(24/44): libdc1394-2.2.2-11.fc29.x86_64.rpm      69 kB/s | 122 kB     00:01    
(25/44): libgta-1.0.7-8.fc29.x86_64.rpm          23 kB/s |  37 kB     00:01    
(26/44): libkml-1.3.0-14.fc29.x86_64.rpm        213 kB/s | 364 kB     00:01    
(27/44): libucil-0.9.10-17.fc29.x86_64.rpm       39 kB/s |  72 kB     00:01    
(28/44): libunicap-0.9.12-22.fc29.x86_64.rpm     89 kB/s | 124 kB     00:01    
(29/44): libspatialite-4.3.0a-9.fc29.x86_64.rpm 744 kB/s | 2.6 MB     00:03    
(30/44): minizip-1.2.11-14.fc29.x86_64.rpm       18 kB/s |  29 kB     00:01    
(31/44): netcdf-4.4.1.1-10.fc29.x86_64.rpm      368 kB/s | 737 kB     00:02    
(32/44): lapack-3.8.0-10.fc29.x86_64.rpm        749 kB/s | 8.6 MB     00:11    
(33/44): ogdi-3.2.1-2.fc29.x86_64.rpm           209 kB/s | 275 kB     00:01    
(34/44): openblas-openmp-0.3.3-2.fc29.x86_64.rp 838 kB/s | 4.6 MB     00:05    
(35/44): openblas-threads64_-0.3.3-2.fc29.x86_6 933 kB/s | 4.5 MB     00:04    
(36/44): openblas-threads-0.3.3-2.fc29.x86_64.r 742 kB/s | 4.5 MB     00:06    
(37/44): opencv-3.4.1-6.fc29.x86_64.rpm         371 kB/s | 1.6 MB     00:04    
(38/44): opencv-devel-3.4.1-6.fc29.x86_64.rpm   481 kB/s | 881 kB     00:01    
(39/44): openni-1.5.7.10-13.fc29.x86_64.rpm     279 kB/s | 422 kB     00:01    
(40/44): opencv-contrib-3.4.1-6.fc29.x86_64.rpm 475 kB/s | 3.7 MB     00:07    
(41/44): proj-4.9.3-6.fc29.x86_64.rpm           173 kB/s | 230 kB     00:01    
(42/44): tinyxml-2.6.2-17.fc29.x86_64.rpm        44 kB/s |  56 kB     00:01    
(43/44): opencv-core-3.4.1-6.fc29.x86_64.rpm    440 kB/s | 4.2 MB     00:09    
(44/44): xerces-c-3.2.2-1.fc29.x86_64.rpm       407 kB/s | 953 kB     00:02    
--------------------------------------------------------------------------------
合計                                            1.2 MB/s |  55 MB     00:47    
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                        1/1
Installed: proj-4.9.3-6.fc29.x86_64
  インストール中   : proj-4.9.3-6.fc29.x86_64                              1/44
  scriptletの実行中: proj-4.9.3-6.fc29.x86_64                              1/44
Installed: proj-4.9.3-6.fc29.x86_64
Installed: libaec-1.0.4-1.fc29.x86_64
  インストール中   : libaec-1.0.4-1.fc29.x86_64                            2/44
Installed: libaec-1.0.4-1.fc29.x86_64
Installed: hdf5-1.8.20-4.fc29.x86_64
  インストール中   : hdf5-1.8.20-4.fc29.x86_64                             3/44
Installed: hdf5-1.8.20-4.fc29.x86_64
Installed: coin-or-CoinUtils-2.10.14-2.fc29.x86_64
  インストール中   : coin-or-CoinUtils-2.10.14-2.fc29.x86_64               4/44
Installed: coin-or-CoinUtils-2.10.14-2.fc29.x86_64
Installed: libunicap-0.9.12-22.fc29.x86_64
  インストール中   : libunicap-0.9.12-22.fc29.x86_64                       5/44
  scriptletの実行中: libunicap-0.9.12-22.fc29.x86_64                       5/44
Installed: libunicap-0.9.12-22.fc29.x86_64
Installed: geos-3.6.1-10.fc29.x86_64
  インストール中   : geos-3.6.1-10.fc29.x86_64                             6/44
  scriptletの実行中: geos-3.6.1-10.fc29.x86_64                             6/44
Installed: geos-3.6.1-10.fc29.x86_64
Installed: freexl-1.0.5-2.fc29.x86_64
  インストール中   : freexl-1.0.5-2.fc29.x86_64                            7/44
  scriptletの実行中: freexl-1.0.5-2.fc29.x86_64                            7/44
Installed: freexl-1.0.5-2.fc29.x86_64
Installed: libspatialite-4.3.0a-9.fc29.x86_64
  インストール中   : libspatialite-4.3.0a-9.fc29.x86_64                    8/44
  scriptletの実行中: libspatialite-4.3.0a-9.fc29.x86_64                    8/44
Installed: libspatialite-4.3.0a-9.fc29.x86_64
Installed: libucil-0.9.10-17.fc29.x86_64
  インストール中   : libucil-0.9.10-17.fc29.x86_64                         9/44
  scriptletの実行中: libucil-0.9.10-17.fc29.x86_64                         9/44
Installed: libucil-0.9.10-17.fc29.x86_64
Installed: coin-or-Osi-0.107.8-8.fc29.x86_64
  インストール中   : coin-or-Osi-0.107.8-8.fc29.x86_64                    10/44
  scriptletの実行中: coin-or-Osi-0.107.8-8.fc29.x86_64                    10/44
Installed: coin-or-Osi-0.107.8-8.fc29.x86_64
Installed: coin-or-Clp-1.16.10-6.fc28.x86_64
  インストール中   : coin-or-Clp-1.16.10-6.fc28.x86_64                    11/44
  scriptletの実行中: coin-or-Clp-1.16.10-6.fc28.x86_64                    11/44
Installed: coin-or-Clp-1.16.10-6.fc28.x86_64
Installed: netcdf-4.4.1.1-10.fc29.x86_64
  インストール中   : netcdf-4.4.1.1-10.fc29.x86_64                        12/44
  scriptletの実行中: netcdf-4.4.1.1-10.fc29.x86_64                        12/44
Installed: netcdf-4.4.1.1-10.fc29.x86_64
Installed: libgeotiff-1.4.0-14.fc29.x86_64
  インストール中   : libgeotiff-1.4.0-14.fc29.x86_64                      13/44
  scriptletの実行中: libgeotiff-1.4.0-14.fc29.x86_64                      13/44
Installed: libgeotiff-1.4.0-14.fc29.x86_64
Installed: ogdi-3.2.1-2.fc29.x86_64
  インストール中   : ogdi-3.2.1-2.fc29.x86_64                             14/44
Installed: ogdi-3.2.1-2.fc29.x86_64
Installed: xerces-c-3.2.2-1.fc29.x86_64
  インストール中   : xerces-c-3.2.2-1.fc29.x86_64                         15/44
Installed: xerces-c-3.2.2-1.fc29.x86_64
Installed: tinyxml-2.6.2-17.fc29.x86_64
  インストール中   : tinyxml-2.6.2-17.fc29.x86_64                         16/44
  scriptletの実行中: tinyxml-2.6.2-17.fc29.x86_64                         16/44
Installed: tinyxml-2.6.2-17.fc29.x86_64
Installed: openni-1.5.7.10-13.fc29.x86_64
  インストール中   : openni-1.5.7.10-13.fc29.x86_64                       17/44
  scriptletの実行中: openni-1.5.7.10-13.fc29.x86_64                       17/44
Installed: openni-1.5.7.10-13.fc29.x86_64
Installed: openblas-threads64_-0.3.3-2.fc29.x86_64
  インストール中   : openblas-threads64_-0.3.3-2.fc29.x86_64              18/44
  scriptletの実行中: openblas-threads64_-0.3.3-2.fc29.x86_64              18/44
Installed: openblas-threads64_-0.3.3-2.fc29.x86_64
Installed: openblas-threads-0.3.3-2.fc29.x86_64
  インストール中   : openblas-threads-0.3.3-2.fc29.x86_64                 19/44
  scriptletの実行中: openblas-threads-0.3.3-2.fc29.x86_64                 19/44
Installed: openblas-threads-0.3.3-2.fc29.x86_64
Installed: arpack-3.5.0-6.fc28.x86_64
  インストール中   : arpack-3.5.0-6.fc28.x86_64                           20/44
  scriptletの実行中: arpack-3.5.0-6.fc28.x86_64                           20/44
Installed: arpack-3.5.0-6.fc28.x86_64
Installed: openblas-openmp-0.3.3-2.fc29.x86_64
  インストール中   : openblas-openmp-0.3.3-2.fc29.x86_64                  21/44
  scriptletの実行中: openblas-openmp-0.3.3-2.fc29.x86_64                  21/44
Installed: openblas-openmp-0.3.3-2.fc29.x86_64
Installed: minizip-1.2.11-14.fc29.x86_64
  インストール中   : minizip-1.2.11-14.fc29.x86_64                        22/44
Installed: minizip-1.2.11-14.fc29.x86_64
Installed: libgta-1.0.7-8.fc29.x86_64
  インストール中   : libgta-1.0.7-8.fc29.x86_64                           23/44
  scriptletの実行中: libgta-1.0.7-8.fc29.x86_64                           23/44
Installed: libgta-1.0.7-8.fc29.x86_64
Installed: libdc1394-2.2.2-11.fc29.x86_64
  インストール中   : libdc1394-2.2.2-11.fc29.x86_64                       24/44
  scriptletの実行中: libdc1394-2.2.2-11.fc29.x86_64                       24/44
Installed: libdc1394-2.2.2-11.fc29.x86_64
Installed: libdap-3.19.1-2.fc29.x86_64
  インストール中   : libdap-3.19.1-2.fc29.x86_64                          25/44
  scriptletの実行中: libdap-3.19.1-2.fc29.x86_64                          25/44
Installed: libdap-3.19.1-2.fc29.x86_64
Installed: cfitsio-3.450-2.fc29.x86_64
  インストール中   : cfitsio-3.450-2.fc29.x86_64                          26/44
  scriptletの実行中: cfitsio-3.450-2.fc29.x86_64                          26/44
Installed: cfitsio-3.450-2.fc29.x86_64
Installed: blas-3.8.0-10.fc29.x86_64
  インストール中   : blas-3.8.0-10.fc29.x86_64                            27/44
  scriptletの実行中: blas-3.8.0-10.fc29.x86_64                            27/44
Installed: blas-3.8.0-10.fc29.x86_64
Installed: lapack-3.8.0-10.fc29.x86_64
  インストール中   : lapack-3.8.0-10.fc29.x86_64                          28/44
  scriptletの実行中: lapack-3.8.0-10.fc29.x86_64                          28/44
Installed: lapack-3.8.0-10.fc29.x86_64
Installed: SuperLU-5.2.1-5.fc29.x86_64
  インストール中   : SuperLU-5.2.1-5.fc29.x86_64                          29/44
Installed: SuperLU-5.2.1-5.fc29.x86_64
Installed: armadillo-9.600.6-1.fc29.x86_64
  インストール中   : armadillo-9.600.6-1.fc29.x86_64                      30/44
Installed: armadillo-9.600.6-1.fc29.x86_64
Installed: CharLS-1.0-17.fc29.x86_64
  インストール中   : CharLS-1.0-17.fc29.x86_64                            31/44
  scriptletの実行中: CharLS-1.0-17.fc29.x86_64                            31/44
Installed: CharLS-1.0-17.fc29.x86_64
Installed: gdcm-2.8.4-10.fc29.x86_64
  インストール中   : gdcm-2.8.4-10.fc29.x86_64                            32/44
  scriptletの実行中: gdcm-2.8.4-10.fc29.x86_64                            32/44
Installed: gdcm-2.8.4-10.fc29.x86_64
Installed: uriparser-0.9.3-1.fc29.x86_64
  インストール中   : uriparser-0.9.3-1.fc29.x86_64                        33/44
Installed: uriparser-0.9.3-1.fc29.x86_64
Installed: libkml-1.3.0-14.fc29.x86_64
  インストール中   : libkml-1.3.0-14.fc29.x86_64                          34/44
  scriptletの実行中: libkml-1.3.0-14.fc29.x86_64                          34/44
Installed: libkml-1.3.0-14.fc29.x86_64
Installed: unixODBC-2.3.7-2.fc29.x86_64
  インストール中   : unixODBC-2.3.7-2.fc29.x86_64                         35/44
  scriptletの実行中: unixODBC-2.3.7-2.fc29.x86_64                         35/44
Installed: unixODBC-2.3.7-2.fc29.x86_64
Installed: postgresql-libs-10.10-1.fc29.x86_64
  インストール中   : postgresql-libs-10.10-1.fc29.x86_64                  36/44
  scriptletの実行中: postgresql-libs-10.10-1.fc29.x86_64                  36/44
Installed: postgresql-libs-10.10-1.fc29.x86_64
Installed: mariadb-connector-c-config-3.1.5-1.fc29.noarch
  インストール中   : mariadb-connector-c-config-3.1.5-1.fc29.noarch       37/44
Installed: mariadb-connector-c-config-3.1.5-1.fc29.noarch
Installed: mariadb-connector-c-3.1.5-1.fc29.x86_64
  インストール中   : mariadb-connector-c-3.1.5-1.fc29.x86_64              38/44
Installed: mariadb-connector-c-3.1.5-1.fc29.x86_64
Installed: gdal-libs-2.3.2-1.fc29.x86_64
  インストール中   : gdal-libs-2.3.2-1.fc29.x86_64                        39/44
  scriptletの実行中: gdal-libs-2.3.2-1.fc29.x86_64                        39/44
Installed: gdal-libs-2.3.2-1.fc29.x86_64
Installed: libva-2.4.1-1.fc29.x86_64
  インストール中   : libva-2.4.1-1.fc29.x86_64                            40/44
Installed: libva-2.4.1-1.fc29.x86_64
Installed: opencv-contrib-3.4.1-6.fc29.x86_64
  インストール中   : opencv-contrib-3.4.1-6.fc29.x86_64                   41/44
Installed: opencv-contrib-3.4.1-6.fc29.x86_64
Installed: opencv-core-3.4.1-6.fc29.x86_64
  インストール中   : opencv-core-3.4.1-6.fc29.x86_64                      42/44
Installed: opencv-core-3.4.1-6.fc29.x86_64
Installed: opencv-3.4.1-6.fc29.x86_64
  インストール中   : opencv-3.4.1-6.fc29.x86_64                           43/44
Installed: opencv-3.4.1-6.fc29.x86_64
Installed: opencv-devel-3.4.1-6.fc29.x86_64
  インストール中   : opencv-devel-3.4.1-6.fc29.x86_64                     44/44
Installed: opencv-devel-3.4.1-6.fc29.x86_64
  scriptletの実行中: opencv-devel-3.4.1-6.fc29.x86_64                     44/44
  検証             : armadillo-9.600.6-1.fc29.x86_64                       1/44
  検証             : coin-or-CoinUtils-2.10.14-2.fc29.x86_64               2/44
  検証             : gdal-libs-2.3.2-1.fc29.x86_64                         3/44
  検証             : libaec-1.0.4-1.fc29.x86_64                            4/44
  検証             : libva-2.4.1-1.fc29.x86_64                             5/44
  検証             : mariadb-connector-c-3.1.5-1.fc29.x86_64               6/44
  検証             : mariadb-connector-c-config-3.1.5-1.fc29.noarch        7/44
  検証             : postgresql-libs-10.10-1.fc29.x86_64                   8/44
  検証             : unixODBC-2.3.7-2.fc29.x86_64                          9/44
  検証             : uriparser-0.9.3-1.fc29.x86_64                        10/44
  検証             : CharLS-1.0-17.fc29.x86_64                            11/44
  検証             : SuperLU-5.2.1-5.fc29.x86_64                          12/44
  検証             : arpack-3.5.0-6.fc28.x86_64                           13/44
  検証             : blas-3.8.0-10.fc29.x86_64                            14/44
  検証             : cfitsio-3.450-2.fc29.x86_64                          15/44
  検証             : coin-or-Clp-1.16.10-6.fc28.x86_64                    16/44
  検証             : coin-or-Osi-0.107.8-8.fc29.x86_64                    17/44
  検証             : freexl-1.0.5-2.fc29.x86_64                           18/44
  検証             : gdcm-2.8.4-10.fc29.x86_64                            19/44
  検証             : geos-3.6.1-10.fc29.x86_64                            20/44
  検証             : hdf5-1.8.20-4.fc29.x86_64                            21/44
  検証             : lapack-3.8.0-10.fc29.x86_64                          22/44
  検証             : libdap-3.19.1-2.fc29.x86_64                          23/44
  検証             : libdc1394-2.2.2-11.fc29.x86_64                       24/44
  検証             : libgeotiff-1.4.0-14.fc29.x86_64                      25/44
  検証             : libgta-1.0.7-8.fc29.x86_64                           26/44
  検証             : libkml-1.3.0-14.fc29.x86_64                          27/44
  検証             : libspatialite-4.3.0a-9.fc29.x86_64                   28/44
  検証             : libucil-0.9.10-17.fc29.x86_64                        29/44
  検証             : libunicap-0.9.12-22.fc29.x86_64                      30/44
  検証             : minizip-1.2.11-14.fc29.x86_64                        31/44
  検証             : netcdf-4.4.1.1-10.fc29.x86_64                        32/44
  検証             : ogdi-3.2.1-2.fc29.x86_64                             33/44
  検証             : openblas-openmp-0.3.3-2.fc29.x86_64                  34/44
  検証             : openblas-threads-0.3.3-2.fc29.x86_64                 35/44
  検証             : openblas-threads64_-0.3.3-2.fc29.x86_64              36/44
  検証             : opencv-3.4.1-6.fc29.x86_64                           37/44
  検証             : opencv-contrib-3.4.1-6.fc29.x86_64                   38/44
  検証             : opencv-core-3.4.1-6.fc29.x86_64                      39/44
  検証             : opencv-devel-3.4.1-6.fc29.x86_64                     40/44
  検証             : openni-1.5.7.10-13.fc29.x86_64                       41/44
  検証             : proj-4.9.3-6.fc29.x86_64                             42/44
  検証             : tinyxml-2.6.2-17.fc29.x86_64                         43/44
  検証             : xerces-c-3.2.2-1.fc29.x86_64                         44/44

インストール済み:
  opencv-devel-3.4.1-6.fc29.x86_64                                              
  armadillo-9.600.6-1.fc29.x86_64                                              
  coin-or-CoinUtils-2.10.14-2.fc29.x86_64                                      
  gdal-libs-2.3.2-1.fc29.x86_64                                                
  libaec-1.0.4-1.fc29.x86_64                                                    
  libva-2.4.1-1.fc29.x86_64                                                    
  mariadb-connector-c-3.1.5-1.fc29.x86_64                                      
  mariadb-connector-c-config-3.1.5-1.fc29.noarch                                
  postgresql-libs-10.10-1.fc29.x86_64                                          
  unixODBC-2.3.7-2.fc29.x86_64                                                  
  uriparser-0.9.3-1.fc29.x86_64                                                
  CharLS-1.0-17.fc29.x86_64                                                    
  SuperLU-5.2.1-5.fc29.x86_64                                                  
  arpack-3.5.0-6.fc28.x86_64                                                    
  blas-3.8.0-10.fc29.x86_64                                                    
  cfitsio-3.450-2.fc29.x86_64                                                  
  coin-or-Clp-1.16.10-6.fc28.x86_64                                            
  coin-or-Osi-0.107.8-8.fc29.x86_64                                            
  freexl-1.0.5-2.fc29.x86_64                                                    
  gdcm-2.8.4-10.fc29.x86_64                                                    
  geos-3.6.1-10.fc29.x86_64                                                    
  hdf5-1.8.20-4.fc29.x86_64                                                    
  lapack-3.8.0-10.fc29.x86_64                                                  
  libdap-3.19.1-2.fc29.x86_64                                                  
  libdc1394-2.2.2-11.fc29.x86_64                                                
  libgeotiff-1.4.0-14.fc29.x86_64                                              
  libgta-1.0.7-8.fc29.x86_64                                                    
  libkml-1.3.0-14.fc29.x86_64                                                  
  libspatialite-4.3.0a-9.fc29.x86_64                                            
  libucil-0.9.10-17.fc29.x86_64                                                
  libunicap-0.9.12-22.fc29.x86_64                                              
  minizip-1.2.11-14.fc29.x86_64                                                
  netcdf-4.4.1.1-10.fc29.x86_64                                                
  ogdi-3.2.1-2.fc29.x86_64                                                      
  openblas-openmp-0.3.3-2.fc29.x86_64                                          
  openblas-threads-0.3.3-2.fc29.x86_64                                          
  openblas-threads64_-0.3.3-2.fc29.x86_64                                      
  opencv-3.4.1-6.fc29.x86_64                                                    
  opencv-contrib-3.4.1-6.fc29.x86_64                                            
  opencv-core-3.4.1-6.fc29.x86_64                                              
  openni-1.5.7.10-13.fc29.x86_64                                                
  proj-4.9.3-6.fc29.x86_64                                                      
  tinyxml-2.6.2-17.fc29.x86_64                                                  
  xerces-c-3.2.2-1.fc29.x86_64                                                  

完了しました!
$

インストール。
かなりたくさんのライブラリが必要みたいである。

imreadで読み込んだ"test.bmp"をimshowで表示。
キー入力すると表示ウィンドウが閉じてプログラムが終了。

実行すると"test.bmp"がこのように表示される
実行すると"test.bmp"がこのように表示される

実行すると"test.bmp"がこのように表示される。

キー入力すると閉じてプログラムが終了
キー入力すると閉じてプログラムが終了

キー入力すると閉じてプログラムが終了。
ただ、ウィンドウをこっちで閉じてしまうとプロセスは動いたままで待ち状態のままになってしまう模様。

Sample/opencv/imshow/imshow/src/imshow at master · bg1bgst333/Sample · GitHub

glutMainLoop

OpenGLは、オープン標準として公開されているクロスプラットフォームなグラフィックスライブラリ。

OpenGL - The Industry Standard for High Performance Graphics
はじめての OpenGL
GLUTによる「手抜き」OpenGL入門
Ubuntu ,Fedora ,Raspberry Pi への GLUT のインストール方法 | Iwao Dev
GLUT を使える様に - Iwao MISH

構成としては、OpenGL本体と、サポートライブラリのGLUTがあるが、今回は簡単に始めたいので、まずはGLUT(正確にはfreeglut)を扱っていく。
今回は、ウィンドウを表示するのみ。

yum searchで、"opengl"としても、

$ yum search opengl
メタデータの期限切れの最終確認: x days, x:xx:xx 時間前の xxxx年xx月xx日 xx時xx分xx秒 に実施しました。
=========================== 名前 & 概要 一致: opengl ===========================
perl-OpenGL.x86_64 : Perl OpenGL bindings
ghc-OpenGL.x86_64 : Haskell OpenGL library
ghc-OpenGLRaw.x86_64 : Haskell OpenGLRaw library
hugs98-opengl.x86_64 : OpenGL package for Hugs98
rubygem-opengl.x86_64 : An OpenGL wrapper for Ruby
libglvnd-opengl.x86_64 : OpenGL support for libglvnd
libglvnd-opengl.i686 : OpenGL support for libglvnd
libglvnd-opengl.x86_64 : OpenGL support for libglvnd
fifechan-opengl.i686 : OpenGL extension for fifechan
fifechan-opengl.x86_64 : OpenGL extension for fifechan
python2-pyopengl.x86_64 : Python 2 bindings for OpenGL
python3-pyopengl.x86_64 : Python 3 bindings for OpenGL
rubygem-ruby-opengl.noarch : OpenGL Interface for Ruby
python3-pyopengl-tk.noarch : PyOpenGL Python 3.x Tk widget
rubygem-opengl-doc.noarch : Documentation for rubygem-opengl
gambas3-gb-opengl.x86_64 : Gambas3 component package for opengl
android-opengl-api-javadoc.noarch : Javadoc for android-opengl-api
ghc-OpenGL-devel.x86_64 : Haskell OpenGL library development files
gambas3-gb-gtk-opengl.x86_64 : Gambas3 component package for gtk-opengl
gambas3-gb-opengl-glu.x86_64 : Gambas3 component package for opengl-glu
gambas3-gb-opengl-sge.x86_64 : Gambas3 component package for opengl-sge
gambas3-gb-qt4-opengl.x86_64 : Gambas3 component package for qt4-opengl
gambas3-gb-qt5-opengl.x86_64 : Gambas3 component package for qt5-opengl
ghc-OpenGLRaw-devel.x86_64 : Haskell OpenGLRaw library development files
gambas3-gb-opengl-glsl.x86_64 : Gambas3 component package for opengl-glsl
fifechan-opengl-devel.i686 : Development files for OpenGL extension for fifechan
fifechan-opengl-devel.x86_64 : Development files for OpenGL extension for
                             : fifechan
nvidia-query-resource-opengl-lib.x86_64 : Library for
                                        : nvidia-query-resource-opengl
nvidia-query-resource-opengl.x86_64 : Querying OpenGL resource usage of
     ...: applications using the NVIDIA OpenGL driver
============================== 名前 一致: opengl ===============================
android-opengl-api.noarch : Google Android Java ME Library (Khronos)
opengl-games-utils.noarch : Utilities to check proper 3d support before
                          : launching 3d games
============================== 概要 一致: opengl ===============================
gl-manpages.noarch : OpenGL manpages
pcb-rnd-hid-gtk2-gl.x86_64 : GUI: gtk2, opengl
tcl-togl.i686 : A Tk OpenGL widget
tcl-togl.x86_64 : A Tk OpenGL widget
foobillard.x86_64 : OpenGL billard game
glaxium.x86_64 : An OpenGL space shooter
gtkglext-libs.i686 : OpenGL Extension to GTK
gtkglext-libs.x86_64 : OpenGL Extension to GTK
apitrace.x86_64 : Tools for tracing OpenGL
glmark2.x86_64 : Benchmark for OpenGL 2.0
gauche-gl.x86_64 : OpenGL binding for Gauche
liboglappth.i686 : An OpenGL wrapper library
liboglappth.x86_64 : An OpenGL wrapper library
mesa-libGLw.i686 : Xt / Motif OpenGL widgets
mesa-libGLw.x86_64 : Xt / Motif OpenGL widgets
GtkAda-gl.x86_64 : GTKada 2 binding to OpenGL
GtkAda3-gl.x86_64 : GTKada 3 binding to OpenGL
tempest.x86_64 : Tempest OpenGL screensaver
SOIL.i686 : Simple OpenGL Image Library
SOIL.x86_64 : Simple OpenGL Image Library
libmml-qt4.i686 : Qt4/OpenGL-based MML Widget
libmml-qt4.x86_64 : Qt4/OpenGL-based MML Widget
libmml-qt5.i686 : Qt5/OpenGL-based MML Widget
libmml-qt5.x86_64 : Qt5/OpenGL-based MML Widget
ftgl.i686 : OpenGL frontend to Freetype 2
ftgl.x86_64 : OpenGL frontend to Freetype 2
quesoglc.i686 : The OpenGL Character Renderer
quesoglc.x86_64 : The OpenGL Character Renderer
rubygem-glu.x86_64 : Glu bindings for the opengl gem
vegastrike.x86_64 : 3D OpenGL spaceflight simulator
glava.x86_64 : OpenGL audio spectrum visualizer
jogl2.x86_64 : Java bindings for the OpenGL API
rubygem-glut.x86_64 : Glut bindings for the OpenGL gem
alleggl.i686 : OpenGL support library for Allegro
alleggl.x86_64 : OpenGL support library for Allegro
erlang-esdl.x86_64 : Erlang OpenGL/SDL API and utilities
gl3n.i686 : An OpenGL Mathematics library for D
gl3n.x86_64 : An OpenGL Mathematics library for D
sage.i686 : OpenGL extensions library using SDL
sage.x86_64 : OpenGL extensions library using SDL
compiz.i686 : OpenGL window and compositing manager
compiz.x86_64 : OpenGL window and compositing manager
glew.x86_64 : The OpenGL Extension Wrangler Library
perl-Wx-GLCanvas.x86_64 : Interface to wxWidgets' OpenGL canvas
libvdpau-va-gl.i686 : VDPAU driver with OpenGL/VAAPI back-end
libvdpau-va-gl.x86_64 : VDPAU driver with OpenGL/VAAPI back-end
compat-wxGTK3-gtk2-gl.i686 : OpenGL add-on for the wxWidgets library
compat-wxGTK3-gtk2-gl.x86_64 : OpenGL add-on for the wxWidgets library
wxGTK-gl.i686 : OpenGL add-on for the wxWidgets library
wxGTK-gl.x86_64 : OpenGL add-on for the wxWidgets library
wxGTK3-gl.i686 : OpenGL add-on for the wxWidgets library
wxGTK3-gl.x86_64 : OpenGL add-on for the wxWidgets library
celestia.x86_64 : OpenGL real-time visual space simulation
gl2ps.i686 : An OpenGL to PostScript printing library
gl2ps.x86_64 : An OpenGL to PostScript printing library
pcb-rnd-lib-gl.x86_64 : Support library for rendering with opengl
glglobe.x86_64 : OpenGl Globe - Earth simulation for linux
libQGLViewer.i686 : Qt based OpenGL generic 3D viewer library
libQGLViewer.x86_64 : Qt based OpenGL generic 3D viewer library
libgle.i686 : A Tubing and Extrusion Library for OpenGL
libgle.x86_64 : A Tubing and Extrusion Library for OpenGL
libreoffice-ogltrans.x86_64 : 3D OpenGL slide transitions for LibreOffice
mingw32-gtkglext.noarch : OpenGL Extension to GTK+ for the Win32 target
mingw64-gtkglext.noarch : OpenGL Extension to GTK+ for the Win64 target
OpenTK.x86_64 : C# library that wraps OpenGL, OpenCL and OpenAL
mednafen.x86_64 : A multi-system emulator utilizing OpenGL and SDL
ocaml-lablgl.x86_64 : LablGL is an OpenGL interface for Objective Caml
libglpng.i686 : Toolkit for loading PNG images as OpenGL textures
libglpng.x86_64 : Toolkit for loading PNG images as OpenGL textures
openuniverse.x86_64 : OpenGL space simulator focused on the Solar System
xscreensaver-gl-base.x86_64 : A base package for screensavers that require
                            : OpenGL
xscreensaver-gl-extras.x86_64 : An enhanced set of screensavers that require
                              : OpenGL
glslang.i686 : OpenGL and OpenGL ES shader front end and validator
glslang.x86_64 : OpenGL and OpenGL ES shader front end and validator
gtkglext-devel.i686 : Development tools for GTK-based OpenGL applications
gtkglext-devel.x86_64 : Development tools for GTK-based OpenGL applications
opencsg.i686 : Library for Constructive Solid Geometry using OpenGL
opencsg.x86_64 : Library for Constructive Solid Geometry using OpenGL
zhu3d.x86_64 : Interactive OpenGL-based mathematical function viewer
GLC_lib.i686 : C++ class library for OpenGL application based on Qt 4
GLC_lib.x86_64 : C++ class library for OpenGL application based on Qt 4
CriticalMass.x86_64 : SDL/OpenGL space shoot'em up game also known as critter
piglit.x86_64 : Collection of automated tests for OpenGL implementations
qwtplot3d.i686 : Qt/OpenGL-based C++ library providing a bunch of 3D-widgets
qwtplot3d.x86_64 : Qt/OpenGL-based C++ library providing a bunch of 3D-widgets
VirtualGL.i686 : A toolkit for displaying OpenGL applications to thin clients
VirtualGL.x86_64 : A toolkit for displaying OpenGL applications to thin clients
qwtplot3d-qt4.i686 : Qt4/OpenGL-based C++ library providing a bunch of
                   : 3D-widgets
qwtplot3d-qt4.x86_64 : Qt4/OpenGL-based C++ library providing a bunch of
                     : 3D-widgets
mingw32-freeglut.noarch : Fedora MinGW alternative to the OpenGL Utility Toolkit
                        : (GLUT)
mingw64-freeglut.noarch : Fedora MinGW alternative to the OpenGL Utility Toolkit
                        : (GLUT)
guichan.i686 : Portable C++ GUI library for games using Allegro, SDL and OpenGL
guichan.x86_64 : Portable C++ GUI library for games using Allegro, SDL and
               : OpenGL
tachyon-gl.x86_64 : Parallel / Multiprocessor Ray Tracing System with OpenGL
                  : display
mingw32-gtkglext-static.noarch : Static version of gtkglext, OpenGL Extension to
                               : GTK+ for the Win32 target
mingw64-gtkglext-static.noarch : Static version of gtkglext, OpenGL Extension to
                               : GTK+ for the Win64 target
$

こんだけいっぱいあって何がなんだかである。
"glut"で探すと、

$ yum search glut
============================ 名前 & 概要 一致: glut ============================
ghc-GLUT.x86_64 : Haskell GLUT library
hugs98-glut.x86_64 : GLUT package for Hugs98
rubygem-glut.x86_64 : Glut bindings for the OpenGL gem
rubygem-glut-doc.noarch : Documentation for rubygem-glut
ghc-GLUT-devel.x86_64 : Haskell GLUT library development files
freeglut.i686 : A freely licensed alternative to the GLUT library
freeglut.x86_64 : A freely licensed alternative to the GLUT library
freeglut-devel.i686 : Freeglut developmental libraries and header files
freeglut-devel.x86_64 : Freeglut developmental libraries and header files
mingw32-freeglut.noarch : Fedora MinGW alternative to the OpenGL Utility Toolkit
                        : (GLUT)
mingw64-freeglut.noarch : Fedora MinGW alternative to the OpenGL Utility Toolkit
                        : (GLUT)
=============================== 概要 一致: glut ================================
glui.i686 : A GLUT-Based User Interface Library
glui.x86_64 : A GLUT-Based User Interface Library
$

絞れてきた。
今回は、freeglutを使うので、

[bg1@localhost Sample]$ sudo yum install freeglut freeglut-devel
[sudo] bg1 のパスワード:
Waiting for process with pid 3162 to finish.
Fedora Modular 29 - x86_64                      4.5 kB/s | 7.4 kB     00:01    
Fedora Modular 29 - x86_64 - Updates            4.4 kB/s | 7.0 kB     00:01    
Fedora 29 - x86_64 - Updates                    4.3 kB/s | 7.1 kB     00:01    
Fedora 29 - x86_64                              4.3 kB/s | 7.6 kB     00:01    
依存関係が解決しました。
================================================================================
 パッケージ             アーキテクチャー
                                    バージョン                リポジトリ  サイズ
================================================================================
インストール:
 freeglut               x86_64      3.0.0-9.fc29              fedora      183 k
 freeglut-devel         x86_64      3.0.0-9.fc29              fedora      112 k
依存関係をインストール中:
 gl-manpages            noarch      1.1-16.20161227.fc29      fedora      1.2 M
 mesa-libGLU            x86_64      9.0.0-16.fc29             fedora      182 k
 mesa-libGLU-devel      x86_64      9.0.0-16.fc29             fedora       13 k

トランザクションの概要
================================================================================
インストール  5 パッケージ

ダウンロードサイズの合計: 1.6 M
インストール済みのサイズ: 2.3 M
これでよろしいですか? [y/N]: y
パッケージのダウンロード中です:
(1/5): freeglut-devel-3.0.0-9.fc29.x86_64.rpm    51 kB/s | 112 kB     00:02    
(2/5): freeglut-3.0.0-9.fc29.x86_64.rpm          68 kB/s | 183 kB     00:02    
(3/5): mesa-libGLU-9.0.0-16.fc29.x86_64.rpm     196 kB/s | 182 kB     00:00    
(4/5): gl-manpages-1.1-16.20161227.fc29.noarch. 342 kB/s | 1.2 MB     00:03    
(5/5): mesa-libGLU-devel-9.0.0-16.fc29.x86_64.r  17 kB/s |  13 kB     00:00    
--------------------------------------------------------------------------------
合計                                            176 kB/s | 1.6 MB     00:09    
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                        1/1
Installed: mesa-libGLU-9.0.0-16.fc29.x86_64
  インストール中   : mesa-libGLU-9.0.0-16.fc29.x86_64                       1/5
Installed: mesa-libGLU-9.0.0-16.fc29.x86_64
Installed: gl-manpages-1.1-16.20161227.fc29.noarch
  インストール中   : gl-manpages-1.1-16.20161227.fc29.noarch                2/5
Installed: gl-manpages-1.1-16.20161227.fc29.noarch
Installed: mesa-libGLU-devel-9.0.0-16.fc29.x86_64
  インストール中   : mesa-libGLU-devel-9.0.0-16.fc29.x86_64                 3/5
Installed: mesa-libGLU-devel-9.0.0-16.fc29.x86_64
Installed: freeglut-3.0.0-9.fc29.x86_64
  インストール中   : freeglut-3.0.0-9.fc29.x86_64                           4/5
  scriptletの実行中: freeglut-3.0.0-9.fc29.x86_64                           4/5
Installed: freeglut-3.0.0-9.fc29.x86_64
Installed: freeglut-devel-3.0.0-9.fc29.x86_64
  インストール中   : freeglut-devel-3.0.0-9.fc29.x86_64                     5/5
Installed: freeglut-devel-3.0.0-9.fc29.x86_64
  scriptletの実行中: freeglut-devel-3.0.0-9.fc29.x86_64                     5/5
  検証             : freeglut-3.0.0-9.fc29.x86_64                           1/5
  検証             : freeglut-devel-3.0.0-9.fc29.x86_64                     2/5
  検証             : gl-manpages-1.1-16.20161227.fc29.noarch                3/5
  検証             : mesa-libGLU-9.0.0-16.fc29.x86_64                       4/5
  検証             : mesa-libGLU-devel-9.0.0-16.fc29.x86_64                 5/5

インストール済み:
  freeglut-3.0.0-9.fc29.x86_64              freeglut-devel-3.0.0-9.fc29.x86_64  
  gl-manpages-1.1-16.20161227.fc29.noarch   mesa-libGLU-9.0.0-16.fc29.x86_64    
  mesa-libGLU-devel-9.0.0-16.fc29.x86_64  

完了しました!
$

とインストール。

main.cで、

とする。
いろいろあるが、

3.1 glutMainLoop

glutMainLoopがメインループで、ウィンドウを閉じるまで抜けない。

ウィンドウ表示
ウィンドウ表示

実行すると、こんな感じでウィンドウ表示される。

閉じると終了
閉じると終了

閉じるとglutMainLoopから抜けて終了する。

Sample/opengl/glutMainLoop/glutMainLoop/src/glutMainLoop at master · bg1bgst333/Sample · GitHub

Wiz_SingleEntryUnzip

zipを解凍する。

Info-ZIP Home Page

右下のUnZipのリンクにアクセス
右下のUnZipのリンクにアクセス

右下のUnZipのリンクにアクセス。

UnZipは6.0まで進んでいる
UnZipは6.0まで進んでいる

UnZipは6.0まで進んでいる。

下にスクロールしてDownloads
下にスクロールしてDownloads

下にスクロールしてDownloads。

こっちもFROZEN
こっちもFROZEN

こっちもFROZEN。

結局sourceforge
結局sourceforge

結局sourceforge

UnZipは6.xでもvc8用ビルドが用意されているがUnreleased Betasを選ぶ
UnZipは6.xでもvc8用ビルドが用意されているがUnreleased Betasを選ぶ

UnZipは6.xでもvc8用ビルドが用意されているがUnreleased Betasを選ぶ。

UnZip betas
UnZip betas

UnZip betas。

unzip610b.zipをダウンロード
unzip610b.zipをダウンロード

unzip610b.zipをダウンロード。

解凍して配置
解凍して配置

解凍して配置。

windll
windll

windll。

vc8
vc8

vc8。

ソリューションを開く
ソリューションを開く

ソリューションを開く。

こちらはDLLとexampleが揃っていてすぐビルドできた。
こちらはDLLとexampleが揃っていてすぐビルドできた。

こちらはDLLとexampleが揃っていてすぐビルドできた。

releaseも
releaseも

releaseも。

ここにDLL
ここにDLL

ここにDLL。

解凍には、Wiz_SingleEntryUnzipを使う。
UnZipだからUzp~かとおもったが、Wiz~である。
(この辺がなんとも・・・。)

新規作成
新規作成

新規作成。

空プロコンソール
空プロコンソール

空プロコンソール。

今回はさすがにc
今回はさすがにc

今回はさすがにc。

オプション
オプション

オプション。

インクルードにunzipのフォルダも追加
インクルードにunzipのフォルダも追加

インクルードにunzipのフォルダも追加。

ライブラリも
ライブラリも

ライブラリも。

プロパティでマルチバイト文字セット
プロパティでマルチバイト文字セット

プロパティでマルチバイト文字セット。

releaseも
releaseも

releaseも。

実行ファイルを適当に作っておいて横にdllを置く
実行ファイルを適当に作っておいて横にdllを置く

実行ファイルを適当に作っておいて横にdllを置く。

releaseも
releaseも

releaseも。

unzipの優先順位を上げる
unzipの優先順位を上げる

なんかビルドエラーが起こるなあと思ったら、zipのstructsを読んでしまっていたので、unzipの優先順位を上げる。

今回もshlwapiが要る
今回もshlwapiが要る

今回もshlwapiが要る。

PATH_MAX
PATH_MAX

PATH_MAXって何かと思ったが、zipのほうはこれでdefineしていたが、unzipにはないようなのでMAX_PATHに差し替え。

最終的に、main.cは、

こうなった。
Wiz_SingleEntryUnzipの第1から第4引数までで、コマンドラインを渡すようだが、難しそうなので、出力元と出力先の情報はDCLのほうに渡した。

test.zipを置く
test.zipを置く

test.zipを置く。

OK
OK

OK。

test.txtが置かれている。
test.txtが置かれている。

test.txtが置かれている。

ちゃんと書かれてる
ちゃんと書かれてる

ちゃんと書かれてる。
releaseも同様にできた。
複数ファイルや複雑なオプションはともかく、解凍はできた。

Sample/info-zip/Wiz_SingleEntryUnzip/Wiz_SingleEntryUnzip/src/Wiz_SingleEntryUnzip at master · bg1bgst333/Sample · GitHub

ZpArchive

以前、ライブラリ系だと、libjpeg、zlib、libpng、と一緒に、Info-ZIPも試したことがあったが、今回改めて試すと、非常に大変なことがわかった。

Info-ZIP Home Page

今回は、zipへの圧縮を行う。

Info-ZIPのトップページ
Info-ZIPのトップページ

Info-ZIPのトップページに行って、
Zipのリンクを押すと、

Zipのトップ
Zipのトップ

Zipのトップ。
source codeを押すと、

みんなFROZENで落とせない。
みんなFROZENで落とせない。

みんなFROZENで落とせない。

結局sourceforgeに飛ばざるを得ない
結局sourceforgeに飛ばざるを得ない

結局sourceforgeに飛ばざるを得ない。

Info-ZIP's Zip

sourceforge
sourceforge

sourceforge

もう、わかってるとおもいますが、最初Linuxでやろうとおもいましたが、Info-ZIPはLinux版はzipやunzipのツールのみ提供で、DLLとかライブラリとして使えるビルドを持ってるのはWindows版だけみたいなんですよねえ、調べたけどLinuxはみつからず。

そして、そのあと実は、上の写真のZip 3.x(latest)でも試したんですが、windllのdllやexampleが、dswとかdsp形式のプロジェクトで、おそらくVisualC++6.0プロジェクトとかかなり古いんですよねえ。

実際ビルドすると失敗し、いろいろいじったけど断念。
現在だと、Unreleased Betasが妥当かなと。

Zip betas
Zip betas

Zip betasの、

zip31c
zip31c

zip31c.zipが、なんとか動かせそう。
ダウンロードしたら、zipを解凍して、

配置
配置

配置。
ライブラリ系はだいたいC直下。

windll
windll

windll。

vc8
vc8

vc8。

DLLのソリューションファイル
DLLのソリューションファイル

DLLのソリューションファイル。

サクッとビルドできた。
サクッとビルドできた。

3.0のdsw/dsp版(VC6?版)だとエラーが酷かったんですが、3.1cのこれだとサクッとビルドできた。

releaseも問題なく
releaseも問題なく

releaseも問題なく。

example、これを見ないとわからない。
example、これを見ないとわからない。

個人的な感想ですが、Info-ZIPのライブラリとしての情報って探しても全然無いので、example、これを見ないとわからない。

これもvc8を選ぶ
これもvc8を選ぶ

これもvc8を選ぶ。

これを起動
これを起動

これを起動。

これもビルドができた
これもビルドができた

これもビルドができた。

releaseも
releaseも

releaseも。

実はlib版もある
実はlib版もある

これはexampleの方だけど、実はwindllもexampleもDLL版だけじゃなくて、lib版もあってそれもビルドできそうだったのだが、結局ビルドエラーで断念した。

まあマルチバイトにしないといけないとかね
まあマルチバイトにしないといけないとかね

まあマルチバイトにしないといけないとかね。
まあ、ここはあんまり関係ないんだけど。

VC8用なのにこういうとこおかしい。VC6になってる

VC8用なのにこういうとこおかしい。VC6になってる。

これ元は追加の依存ファイルにlibがなかった。ので追加した。
これ元は追加の依存ファイルにlibがなかった。ので追加した。

これ元は追加の依存ファイルにlibがなかった。ので追加した。
releaseでもやったけど、

それでもダメだった。
それでもダメだった。

それでもダメだった。

DLLに戻る
DLLに戻る

DLLに戻る。
今回、releaseのDLLを使う。

新規のプロジェクトとして作成
新規のプロジェクトとして作成

新規のプロジェクトとして作成。

毎度の空プロコンソール
毎度の空プロコンソール

毎度の空プロコンソール。

とりあえずはcppで
とりあえずはcppで

とりあえずはcppで。

プロパティでマルチバイト文字セット
プロパティでマルチバイト文字セット

プロパティでマルチバイト文字セット。

releaseも
releaseも

releaseも。

[[ツール]-[オプション]]
[ツール]-[オプション]

[ツール]-[オプション]。

インクルード
インクルード

インクルードにzip31cのパス。

DLLはライブラリのここに
DLLはライブラリのここに

DLLはライブラリのここに。

インクルードはここも追加
インクルードはここも追加

DLL用のヘッダもあるので、インクルードはここも追加。

DLLをEXEの横に
DLLをEXEの横に

DLLをEXEの横に。

releaseにも
releaseにも

releaseにも。

main.cppだからextern "C"とかいろいろやったけど治まらず
main.cppだからextern "C"とかいろいろやったけど治まらず

main.cppだからextern "C"とかいろいろやったけど治まらず。

今回は時間ないのでmain.cに変えた。
今回は時間ないのでmain.cに変えた。

今回は時間ないのでmain.cに変えた。

test.txtを準備
test.txtを準備

test.txtを準備。

こんな感じにしておく
こんな感じにしておく

こんな感じにしておく。

パス周りの処理でshlwapi追加
パス周りの処理でshlwapi追加

パス周りの処理でshlwapi追加。

やってることはたいしたことなくて、ユーザ関数とかはどうでもよくて、LoadLibraryして、ZpInitとかZpArchiveとかのポインタを取得して、ZpOptとかをセットして、ZpArchiveの関数ポインタ参照呼出しでtest.txtを圧縮してる。

エラーじゃなかったらOKなんだけど、ファイルがなかったりでもOKなのでちょっとねえ・・・。
エラーじゃなかったらOKなんだけど、ファイルがなかったりでもOKなのでちょっとねえ・・・。

エラーじゃなかったらOKなんだけど、ファイルがなかったりでもOKなのでちょっとねえ・・・。。

なんとかtest.zipができた
なんとかtest.zipができた

なんとかtest.zipができた。

開けるとtest.txtを復元できてる
開けるとtest.txtを復元できてる

開けるとtest.txtを復元できてる。
releaseでも同様にできた。
コードはまあそこまで大変じゃないけど、とにかく調べるのと環境作るのがねえ・・・。
ちなみにVS2017でもexampleで圧縮できたので、vc8以降はなんとか・・・。

Sample/info-zip/ZpArchive/ZpArchive/src/ZpArchive at master · bg1bgst333/Sample · GitHub

png_read_png

png_read_pngで、pngを読み込む。

https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Desktop-generic/LSB-Desktop-generic/libpng12.png.read.png.1.html
libpng 1.2.5 manual
PNG ƒCƒ[ƒW‚ÌŽæ‚舵‚¢
libpngのインストールとC言語での使用方法・使用例 | だえうホームページ

として、

$ ls
bitmap.c  bitmap.h  main  main.c  test.png
$ vi main.c
$ gcc -o main main.c bitmap.c -lpng
$ ./main
$ ls
bitmap.c  bitmap.h  main  main.c  test.bmp  test.png
$

とすると、

PNG形式からBMP形式に戻せた。
PNG形式からBMP形式に戻せた。

PNG形式からBMP形式に戻せた。

Sample/libpng/png_read_png/png_read_png/src/png_read_png at master · bg1bgst333/Sample · GitHub

png_write_png

今回は、libpngを試す。

https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Desktop-generic/LSB-Desktop-generic/libpng12.png.write.png.1.html
libpng 1.2.5 manual
PNG ƒCƒ[ƒW‚ÌŽæ‚舵‚¢
libpngのインストールとC言語での使用方法・使用例 | だえうホームページ

まず、yum search。

$ yum search libpng
Fedora Modular 29 - x86_64                      446 kB/s | 1.5 MB     00:03    
Fedora Modular 29 - x86_64 - Updates            526 kB/s | 2.1 MB     00:04    
Fedora 29 - x86_64 - Updates                    1.7 MB/s |  30 MB     00:17    
Fedora 29 - x86_64                              1.7 MB/s |  62 MB     00:36    
============================ 名前 完全一致: libpng =============================
libpng.i686 : A library of functions for manipulating PNG image format files
libpng.x86_64 : A library of functions for manipulating PNG image format files
=========================== 概要 & 名前 一致: libpng ===========================
mingw32-libpng.noarch : MinGW Windows Libpng library
mingw64-libpng.noarch : MinGW Windows Libpng library
libpng12-devel.i686 : Development files for libpng 1.2
libpng12-devel.x86_64 : Development files for libpng 1.2
libpng10.i686 : Old version of libpng, needed to run old binaries
libpng10.x86_64 : Old version of libpng, needed to run old binaries
libpng10-devel.i686 : Development tools for version 1.0 of libpng
libpng10-devel.x86_64 : Development tools for version 1.0 of libpng
libpng12.i686 : Old version of libpng, needed to run old binaries
libpng12.x86_64 : Old version of libpng, needed to run old binaries
libpng15.i686 : Old version of libpng, needed to run old binaries
libpng15.x86_64 : Old version of libpng, needed to run old binaries
mingw32-libpng-static.noarch : Static version of MinGW Windows Libpng library
mingw64-libpng-static.noarch : Static version of MinGW Windows Libpng library
============================== 名前 一致: libpng ===============================
libpng-devel.i686 : Development tools for programs to manipulate PNG image
                  : format files
libpng-devel.x86_64 : Development tools for programs to manipulate PNG image
                    : format files
libpng-tools.x86_64 : Tools for PNG image format file library
libpng-static.i686 : Static PNG image format file library
libpng-static.x86_64 : Static PNG image format file library
$

で、yum install。

$ sudo yum install libpng libpng-devel
[sudo] bg1 のパスワード:
メタデータの期限切れの最終確認: x:xx:xx 時間前の xxxx年xx月xx日 xx時xx分xx秒 に実施しました。
パッケージ libpng-2:1.6.34-6.fc29.x86_64 は既にインストールされています。
パッケージ libpng-devel-2:1.6.34-6.fc29.x86_64 は既にインストールされています。
依存関係が解決しました。
行うべきことはありません。
完了しました!
$

まあ、入ってるよね。
libjpegの時のビットマップ処理関数も使って、

png_write_pngで書き込む。
これは高水準APIらしい。
下から上に入れるところと、RGBじゃなくてBGRというところがポイント。

$ ls
bitmap.c  bitmap.h  main  main.c  test.bmp
$ vi main.c
$ gcc -o main main.c bitmap.c -lpng
$ ./main
$ ls
bitmap.c  bitmap.h  main  main.c  test.bmp  test.png
$

とすると、

BMP形式からPNG形式に変換できた。
BMP形式からPNG形式に変換できた。

BMP形式からPNG形式に変換できた。
(粗いのは、libjpegのjpeg_start_decompressの項で生成したbmpファイルだから。)

Sample/libpng/png_write_png/png_write_png/src/png_write_png at master · bg1bgst333/Sample · GitHub