2023-12-29 bugを発見して修正した。opencvはBGRなのにgradioはRGBの順番でデータを持っていたのかよ!

  • project_github\practiceGradio\image_adjuster にapp.py をアップロードし直して
  • https://huggingface.co/spaces/juyam/image_adjuster 期待通りの結果になることを確認した。ひとまず完了だ。
  • image

  • 下記は practicePython\opencv\image_comparison\color_remap_visualization.py により、変換前(横軸)と変換後(縦軸)がどう対応しているかを可視化したもの。
  • (注意点はBGRなのと、左上が原点だったので左下原点にする為に反時計回り回転が必要だったこと) created_image

2023-12-29 オリジナルと加工後の画像から、RGBのそれぞれのデータ変換を推測してみた

  • 下記の結果をゲットするのに使ったコードは practicePython\opencv\image_comparison\image_comparison.py
[39, 44, 44, 40, 43, 45, 46, 46, 50, 49, 48, 52, 49, 51, 51, 52, 53, 54, 54, 54, 57, 59, 57, 59, 58, 63, 61, 28, 64, 66, 71, 69, 71, 71, 75, 78, 79, 79, 78, 81, 82, 82, 88, 85, 93, 92, 91, 92, 92, 94, 94, 94, 97, 98, 100, 104, 103, 87, 69, 115, 116, 114, 115, 65, 115, 118, 118, 121, 121, 122, 124, 123, 127, 128, 127, 128, 132, 131, 132, 135, 137, 136, 139, 140, 141, 143, 144, 145, 145, 148, 163, 150, 171, 167, 153, 154, 156, 155, 158, 158, 158, 161, 161, 161, 162, 164, 167, 165, 49, 166, 167, 168, 169, 170, 171, 172, 171, 173, 172, 175, 175, 176, 176, 177, 182, 182, 180, 183, 181, 184, 196, 186, 188, 186, 186, 186, 201, 188, 202, 203, 203, 204, 205, 205, 195, 205, 205, 196, 197, 208, 210, 205, 198, 198, 202, 212, 202, 213, 213, 203, 214, 214, 215, 215, 216, 216, 212, 212, 219, 211, 211, 215, 215, 215, 214, 216, 218, 219, 215, 217, 220, 221, 221, 221, 221, 221, 221, 224, 224, 223, 223, 225, 224, 226, 227, 228, 226, 228, 227, 227, 229, 228, 229, 231, 230, 231, 232, 232, 234, 234, 235, 235, 236, 236, 238, 237, 237, 239, 238, 239, 239, 240, 240, 241, 241, 242, 237, 237, 243, 244, 244, 241, 244, 246, 246, 247, 248, 249, 247, 248, 249, 250, 250, 255, 255, 255, 252, 255, 255, 255, 255, 255, 255, 255, 255, 255]
[28, 29, 29, 32, 32, 34, 35, 35, 35, 37, 35, 36, 38, 40, 40, 41, 41, 43, 43, 43, 45, 47, 47, 48, 48, 50, 51, 52, 52, 53, 40, 58, 58, 59, 60, 60, 63, 63, 65, 65, 66, 70, 68, 71, 49, 50, 51, 51, 51, 52, 52, 53, 86, 88, 55, 55, 56, 57, 96, 98, 100, 100, 100, 106, 106, 107, 110, 111, 112, 113, 115, 116, 118, 119, 121, 122, 123, 125, 126, 126, 128, 129, 130, 131, 132, 134, 135, 136, 136, 138, 137, 137, 140, 138, 143, 143, 145, 145, 147, 147, 148, 150, 150, 151, 150, 154, 152, 152, 156, 153, 156, 159, 156, 158, 158, 160, 160, 160, 162, 162, 159, 164, 166, 164, 167, 167, 169, 168, 168, 171, 144, 171, 172, 174, 173, 174, 174, 178, 176, 177, 178, 180, 180, 180, 180, 181, 182, 182, 183, 183, 184, 186, 186, 187, 188, 187, 190, 191, 191, 192, 192, 191, 194, 193, 193, 196, 197, 196, 197, 197, 199, 199, 199, 200, 203, 202, 201, 203, 204, 205, 205, 206, 198, 207, 207, 208, 209, 208, 210, 211, 212, 212, 213, 213, 214, 213, 215, 215, 216, 216, 218, 218, 210, 219, 219, 221, 221, 221, 222, 223, 224, 224, 224, 226, 225, 226, 226, 227, 228, 228, 230, 230, 230, 232, 232, 232, 233, 234, 234, 235, 236, 237, 240, 240, 238, 238, 239, 240, 241, 242, 241, 242, 244, 244, 244, 245, 245, 246, 247, 248, 249, 249, 250, 251, 251, 251]
[26, 30, 29, 30, 32, 30, 32, 30, 34, 35, 32, 36, 35, 38, 38, 38, 40, 41, 40, 41, 43, 46, 41, 46, 49, 49, 47, 32, 51, 34, 34, 34, 58, 36, 38, 39, 40, 40, 42, 65, 43, 70, 74, 70, 73, 75, 50, 79, 81, 82, 83, 86, 90, 90, 90, 91, 94, 96, 95, 100, 98, 100, 105, 105, 97, 97, 111, 110, 112, 115, 116, 118, 119, 121, 122, 122, 124, 125, 126, 129, 129, 130, 133, 133, 134, 135, 136, 137, 137, 137, 139, 140, 141, 143, 143, 144, 145, 147, 150, 150, 151, 151, 154, 155, 152, 155, 155, 158, 158, 158, 159, 160, 162, 162, 164, 162, 164, 165, 165, 166, 168, 168, 168, 169, 172, 172, 172, 173, 173, 174, 176, 176, 176, 177, 177, 178, 180, 180, 180, 182, 183, 183, 184, 186, 185, 185, 186, 188, 188, 186, 190, 189, 183, 190, 191, 194, 194, 193, 195, 195, 197, 197, 198, 198, 200, 200, 200, 176, 203, 202, 203, 204, 205, 203, 203, 206, 208, 208, 208, 208, 209, 210, 212, 212, 212, 212, 213, 214, 215, 215, 216, 216, 216, 217, 217, 218, 218, 218, 222, 222, 222, 222, 222, 223, 221, 224, 224, 225, 225, 227, 227, 227, 228, 228, 230, 230, 231, 231, 232, 232, 232, 234, 234, 235, 235, 237, 237, 238, 234, 234, 238, 239, 240, 240, 241, 241, 242, 243, 243, 242, 245, 246, 246, 246, 246, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252]
  • そしてそのデータを利用して B,G,Rのそれぞれを置換した結果が下記。期待したよりも良い結果となった。(左からオリジナル、加工後、俺変換の結果)
  • image
  • なので、とりあえず、この辞書を使ってフィルタを作成してみよう。
  • 作った ver1
    • https://huggingface.co/spaces/juyam/image_adjuster
    • image