static Appraisal CreateAppraisal(Bitmap sourceImage, ComputerVisionService.AnalysisBlob analysisResult) { Caption caption = GetCaption(analysisResult.generalAnalysisResult); Console.WriteLine("Caption: " + caption.Text + " " + caption.Confidence); string foregroundColor = GetForegroundColor(analysisResult.generalAnalysisResult); float confidence = (float)caption.Confidence; bool isOld = IsOld(analysisResult.generalAnalysisResult); float expensiveMultiplier = GetPriceExpensiveMultiplier(analysisResult.generalAnalysisResult); Console.WriteLine("Is Old: " + isOld); bool isBlackAndWhite = IsBlackAndWhite(analysisResult.generalAnalysisResult); Console.WriteLine("Is Black and White: " + isBlackAndWhite); bool isPainting = PaintingDetection.IsPainting(analysisResult); Console.WriteLine("Is Painting: " + isPainting); bool isPhoto = !isPainting && IsPhoto(analysisResult.generalAnalysisResult); Console.WriteLine("Is Photo: " + isPhoto); bool isSign = SignDetection.IsSign(analysisResult); Console.WriteLine("Is Sign: " + isSign); int?extractedYear = YearExtractor.ExtractYear(analysisResult.ocrAnalysisResult); Description.Arguments descriptionArguments = new Description.Arguments { foregroundColor = foregroundColor, isOld = isOld, isBlackAndWhite = isBlackAndWhite, isPainting = isPainting, isPhoto = isPhoto, isSign = isSign, }; string descriptionText = Description.Get(caption, descriptionArguments); Console.WriteLine("Final Description Text: " + descriptionText); Console.WriteLine("Extracted Year: " + extractedYear); string extractedLocale = LanguageCodeToLocation.LookUp(analysisResult.ocrAnalysisResult); Console.WriteLine("Extracted Locale: " + extractedLocale); Random random = GetDeterministicRandom(sourceImage); Bitmap composedImage = ComposeImage(sourceImage, descriptionText, confidence, isOld, isBlackAndWhite && isPhoto, expensiveMultiplier, isPainting, isSign, extractedYear, extractedLocale, random); return(new Appraisal { image = composedImage, comment = descriptionText }); }
public static void LookUpReturnsUsableLocale(string languageCode, string locale) { Assert.Equal(locale, LanguageCodeToLocation.LookUp(languageCode)); }