img_float * img_float is being interpreted as matrix multiplication. If the 2D
slice is not square, then that explains the DimensionMismatch.
If you want elementwise multiplication, you have to use .*
--Tim
On Tuesday, July 01, 2014 04:02:51 PM David A. wrote:
> This works:
> img_float[:,:,1] + (img_float[:,:,1] * 0.5)
>
> but this gives that error:
> img_float[:,:,1] * (img_float[:,:,1] * 0.5)
>
> On Tuesday, July 1, 2014 7:34:04 PM UTC-3, David A. wrote:
> > I'm trying to operate on just one dimension of an Array of 3 dimensions,
> > but getting this: ERROR: DimensionMismatch("*")
> >
> > The steps I'm doing are:
> >
> > img = imread("path-to-image")
> > img_float = convert(Array, img) / 255
> >
> > img_float becomes of type Array{Float64,3}
> > And trying to modify the first dimension like this:
> >
> > img_float[:,:,1] = img_float[:,:,1] + (img_float[:,:,1] * 0.5)
> >
> > This line gives the error: ERROR: DimensionMismatch("*")
> >
> > What's the appropriate way?