I am working on a project for a machine learning class wherein I extract features from a topographic raster map and then classify the traversability of the terrain. One of the features I need to extract is slope. My initial thought was that an approximation of slope at any given point could be extracted from a map by calculating the distance between contour lines. However it seems I took for granted the complexity of extracting the contour lines.
In attempting to solve this problem I found myself trying to learn a number of GIS tools. However I still have not been successful which is why I am here. I have installed gdal and used gdal_contour to generate what I believe to be a DEM. From there I loaded it into qgis along with the original raster map. From this I see that when gdal created the DEM it used only one of the two colors that designate contour lines. Worse yet it used the less frequent color so the resulting contour lines are highly segmented.
This leaves me with a couple of questions. The first is whether it is possible to designate the colors gdal uses to extract contour lines and generate the DEM. The second is whether there is a simpler method for extracting the desired data.