Color channel

I’m learning how to use Julia for image processing. I want to change the values in the color channels. Something like this:

red.(j[:, i]) .= red.(j[:, i])

But I don’t understand why it does not work.

I’d recommend you read

and edit your question accordingly to turn it into an MWE so that people can help you more easily.

Without knowin what red or j is, I’d say your code shouldn’t be valid Julia:

julia> x = rand(3, 2);

julia> sin.(x[:, 2]) = sin.(x[:, 2])
ERROR: syntax: invalid syntax "sin.(x[:, 2]) = ..." around REPL[34]:1

The left hand side of = should be something you can assign to, which red.(j[:, i]) most likely isn’t. Maybe you meant

j[:, i] .= red.(j[:, i])

but again it’s hard to tell without more information.

1 Like