GitHub is down - wow, how inconvenient
Nov. 27th, 2021 05:13 pm73 million developer accounts, 100 million repositories, and plenty of processes depending on GitHub being up...
I created this rather interesting color thing a few days ago and committed it and the Julia notebook which generated it

and now I continued this line of thinking and made another one (and a much cleaner version of code)

and hoped to commit it as well, but...
UPDATE: GitHub is fixed: github.com/anhinga/late-2021-julia-drafts/tree/main/color-motifs
I created this rather interesting color thing a few days ago and committed it and the Julia notebook which generated it

and now I continued this line of thinking and made another one (and a much cleaner version of code)

and hoped to commit it as well, but...
UPDATE: GitHub is fixed: github.com/anhinga/late-2021-julia-drafts/tree/main/color-motifs
no subject
Date: 2021-11-28 12:26 am (UTC)import ImageView: imshow import Images: Gray import TestImages: testimage j = 1*Gray.(testimage("jetplane")) m = 1*testimage("mandrill") typeof(j), typeof(m) import Images: channelview function decompose_color_image(img) ch = channelview(img) return (ch[1,:,:], ch[2,:,:], ch[3,:,:]) end c = decompose_color_image(m) grays = map(x->Gray.(x), c) hcat(grays[1], grays[2], grays[3]) import Images: RGB typeof(RGB.(j)) function colorize(gray_img, c = 1) new_img = RGB.(deepcopy(gray_img)) new_img .= 0 # make it black channelview(new_img)[c,:,:] = gray_img new_img end colorize(grays[1]) colorize(grays[2], 2) colorize(grays[3], 3) function create_colored(img_red, img_green, img_blue) new_img = RGB.(deepcopy(img_red)) new_img .= 0 # make it black channelview(new_img)[1,:,:] = img_red channelview(new_img)[2,:,:] = img_green channelview(new_img)[3,:,:] = img_blue new_img end create_colored(grays...) import LinearAlgebra: transpose function normalize_image(im) im_res = im .- minimum(im) return (1/maximum(im_res))*im_res end matr_j = convert(Matrix{Float32}, j) matr_grays = map(x->convert(Matrix{Float32}, x), grays) mults = map(x->Gray.(normalize_image(matr_j*x)), matr_grays) hcat(mults...) create_colored(mults...) norm_columns(f, x) = f.(x) ./ sum(f.(x), dims=1) norm_rows(f, x) = f.(x) ./ sum(f.(x), dims=2) n_matr_j = normalize_image(norm_rows(x->x+1, matr_j)) Gray.(n_matr_j) n_matr_grays = map(y->normalize_image(norm_columns(x -> x+1, y)), matr_grays) hcat(map(x->Gray.(x), n_matr_grays)...) n_mults = map(x->Gray.(normalize_image(n_matr_j*x)), n_matr_grays) hcat(n_mults...) create_colored(n_mults...)no subject
Date: 2021-11-28 01:11 am (UTC)function colorize_all(i1, i2, i3) hcat(colorize(i1), colorize(i2, 2), colorize(i3, 3)) end