Imread not defined

question

#1

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)

#2

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


#3

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


#4

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.


#5

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


#6

Where is the function read_data from?


#7

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


#8

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


#9

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