Imread not defined

I am getting error like this:
ERROR: LoadError: UndefVarError: imread not defined
in read_data(::String, ::DataFrames.DataFrame, ::Int32, ::String) at FileLocation
Below is my code

nameFile = "$(path)/$(typeData)/$(idImage).Bmp"
  img = imread(nameFile)

Are you using the Images package? Have you installed it with Pkg.add("Images") and declared that you’re using it with using Images?

1 Like

Yes, i have added that in my code on the first line.

It looks like imread is gone in Images 0.6 (replaced by load). It was supposed to give a deprecation warning in Images 0.5.x.

1 Like

Yeah! imread was deprecated load works fine in that place. But after changing that now i am getting
ERROR: LoadError: type Array has no field data in read_data(::String, ::DataFrames.DataFrame, ::Int32, ::String) at file_path
The code is as follows:

xTrain = read_data("train", labelsInfoTrain, imageSize, path)

in which imageSize = 400, path = folder location, labelsInfoTrain = result after reading .csv file by readtable function

Where is the function read_data from?

The old Image type had a field called data, which held the pixel data. The new images uses plain AbstractArrays, so you may need to modify your code so it doesn’t use fooimg.data.

More info is available here: http://juliaimages.github.io/latest/quickstart.html#Images-are-just-arrays-1

What is the command line that I should put in place to imread?

The replacement for imread() is load(). Depending on your platform, load() will use ImageMagick.jl or QuartzImageIO.jl (on a Mac) behind the scenes.