private SignType classifySign(Matrix<float> parameters, SignShape shape) { if (shape == SignShape.Garbage) return SignType.Garbage; return (SignType)(int)SVMModels[(int)shape].Predict(parameters); }
public SignType recognizeSign(BGRImage BGRimage, GrayImage grayImage, SignShape shape, SignColour color, List<DebugImage> aDebugImage = null) { if (shape == SignShape.Garbage && aDebugImage == null) return SignType.Garbage; debugImages = aDebugImage; GrayImage preprosessedImage = preprocess(BGRimage, grayImage); Matrix<float> parameter = calculateParameters(preprosessedImage); SignType classifiedSign = classifySign(parameter, shape); bool boolColor; if (color == SignColour.RED) boolColor = false; else boolColor = true; if (isTrained && shape != SignShape.Garbage) { if (boolColor != SignTypeColor[(int)classifiedSign]) //Console.WriteLine("Color Mishaps"); return SignType.Garbage; return classifiedSign; } else return SignType.Garbage; }