private static bool DetectCat(INeuralNetwork neuralNetwork, Image <Gray, Byte> image) { double[] networkFeed = LocalImage.GetNetworkFeedArray(image); var networkOutput = neuralNetwork.GenerateOutput(networkFeed); var outputValue = networkOutput[0]; var complementaryOutputValue = networkOutput[1]; return(outputValue > 0.95 && complementaryOutputValue < 0.05); }
private static (Image <Gray, Byte>, System.Drawing.Rectangle) GetAreaUnderAnchorBox(Image <Bgr, Byte> originalImage, AnchorBox anchorBox) { var originalImageCopy = originalImage.Copy(); var rectangle = GetRectangleFromAnchroBox(originalImageCopy, anchorBox); originalImageCopy.ROI = rectangle; var croppedImage = LocalImage.ConvertOriginalImageToGrayScaleAndProcess(originalImageCopy.Copy()); originalImageCopy.ROI = System.Drawing.Rectangle.Empty; return(croppedImage, rectangle); }
public static (double[], ImageType) GetImageInformationForNeuralNetwork(LocalImage localImage) { return(GetNetworkFeedArray(localImage.CompressedImage), localImage.ImageType); }