Skip to content

Commit

Permalink
アルファチャンネル追加でのイメージ出力
Browse files Browse the repository at this point in the history
  • Loading branch information
takk committed May 3, 2019
1 parent c274c7e commit edb3998
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion PracticeJava1/src/jp/zenryoku/ml/nd4j/FirstNd4j.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] args) {
} }


/** /**
* 制定メソッドです * 静的メソッドです
* このクラスを起動するときに他の読み込むクラスに同じメソッドは定義できません。 * このクラスを起動するときに他の読み込むクラスに同じメソッドは定義できません。
* 実行時エラーになります。 * 実行時エラーになります。
* *
Expand Down
10 changes: 6 additions & 4 deletions PracticeJava1/src/jp/zenryoku/opencv/OpenCVTest9_AddWeited.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ public class OpenCVTest9_AddWeited {
public static void main(String[] args) { public static void main(String[] args) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
// 真っ白な画像から引き算してみる // 真っ白な画像から引き算してみる
Mat src = Imgcodecs.imread(OpenCVTest9_Substract.class.getResource("/images/rakugaki.png").getPath()); Mat src = Imgcodecs.imread(OpenCVTest9_Substract.class.getResource("/categories/" + "1_create.png").getPath(), Imgcodecs.IMREAD_UNCHANGED);
Mat cart = Imgcodecs.imread(OpenCVTest9_Substract.class.getResource("/images/racgaki2.png").getPath()); Mat cart = Imgcodecs.imread(OpenCVTest9_Substract.class.getResource("/categories/" + "A_design.png").getPath(), Imgcodecs.IMREAD_UNCHANGED);
Mat cart1 = Imgcodecs.imread(OpenCVTest9_Substract.class.getResource("/categories/" + "a_artifacts.png").getPath(), Imgcodecs.IMREAD_UNCHANGED);
System.out.println("*** First ****"); System.out.println("*** First ****");
System.out.println(src.dump());
Mat dst = new Mat(); Mat dst = new Mat();
Core.addWeighted(src, 0.5, cart, 0.5, 0, dst); Core.addWeighted(src, 0.5, cart, 0.5, 0, dst);
Core.addWeighted(dst, 0.5, cart1, 0.5, 0, dst);
System.out.println("*** Second ****"); System.out.println("*** Second ****");
System.out.println(dst.dump()); Imgcodecs.imwrite("/dst/1Aa.png", dst);
// System.out.println(dst.dump());
ViewFrame frame = new ViewFrame(dst); ViewFrame frame = new ViewFrame(dst);
System.out.println("実行時間: " + (System.currentTimeMillis() - start) + "ミリ秒"); System.out.println("実行時間: " + (System.currentTimeMillis() - start) + "ミリ秒");
} }
Expand Down

1 comment on commit edb3998

@ZenryokuService
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

単純にイメージを読み込み'(透過PNG)それを重ねる(掛け算)、ファイルの出力を行う処理に変更

Please sign in to comment.