/// <summary> /// Enhances the contrast of the image of this image processor /// </summary> /// <param name="C">Contrast factor falls in the interval [-1,+INF[</param> public void EnhanceContrast(double C) { try { MWArray path = new MWCharArray(originalImagePath); MWArray res = new MWCharArray(); res = IMC.contrast(path, C); undoStack.Push(new imageProcessorOperation("Brightness Enhancement", res.ToString())); NewImagePath = res.ToString(); } catch (Exception ex) { throw ex; } }
public static double[] resultsForReranking; //stores the image number when images are categories covered by similarity matrix public static string matchClass() { //MessageBox.Show("match initialize"); MatchingClass matchtest = null; MWCharArray output = null; MWArray MWresult = null; matchtest = new MatchingClass(); //MessageBox.Show("start match"); MWresult = matchtest.build_matching_test_correct_csharp2(); output = (MWCharArray)MWresult[1, 1]; matchedClass = output.ToString(); rerankingImageName = -1; return(matchedClass); }
// PARSE ENV_CHECK OUTPUT public string parse_results(MWStructArray result, int print_level) { Console.WriteLine("\n======================= ENVIRONMENT CHECK RESULT ======================="); String[] checker_names = { "vpd_check", "dewpoint_check", "crop_temp_check" }; // READ OUTPUT DETAILS MWStructArray result_checker = new MWStructArray(); MWNumericArray result_code = null; MWNumericArray checker_code = null; MWCharArray result_type = null; MWCharArray result_state = null; MWCharArray result_checkvar_name = null; MWNumericArray result_checkvar_value = null; MWCharArray result_checkvar_unit = null; MWNumericArray result_adjust = null; MWCharArray result_adjust_unit = null; result_code = (MWNumericArray)result.GetField("code"); int nFields = result.NumberOfFields - 1; string result_out = null; for (int ifield = 1; ifield <= nFields; ifield++) { result_checker = (MWStructArray)result.GetField(checker_names[ifield - 1]); checker_code = (MWNumericArray)result_checker.GetField("code"); switch (print_level) { case 0: // PRINT ABNORMAL RESULTS if ((int)checker_code > 0) { result_type = (MWCharArray)result_checker.GetField("type"); result_state = (MWCharArray)result_checker.GetField("state"); result_out = "\n" + result_type.ToString() + " STATUS : " + result_state.ToString(); Console.WriteLine(result_out); } break; case 1: // PRINT ABNORMAL RESULTS + DETAILS if ((int)checker_code > 0) { result_type = (MWCharArray)result_checker.GetField("type"); result_state = (MWCharArray)result_checker.GetField("state"); result_checkvar_name = (MWCharArray)result_checker.GetField("checkvar_name"); result_checkvar_value = (MWNumericArray)result_checker.GetField("checkvar_value"); result_checkvar_unit = (MWCharArray)result_checker.GetField("checkvar_unit"); result_adjust = (MWNumericArray)result_checker.GetField("adjust"); result_adjust_unit = (MWCharArray)result_checker.GetField("adjust_unit"); result_out = "\n" + result_type.ToString() + " STATUS : " + result_state.ToString(); result_out += "\n" + result_checkvar_name.ToString() + " : " + result_checkvar_value.ToString() + " " + result_checkvar_unit.ToString(); result_out += "\n" + "ADJUST : " + result_adjust.ToString() + " " + result_adjust_unit.ToString(); Console.WriteLine(result_out); } break; case 2: // PRINT ALL RESULTS + DETAILS result_type = (MWCharArray)result_checker.GetField("type"); result_state = (MWCharArray)result_checker.GetField("state"); result_checkvar_name = (MWCharArray)result_checker.GetField("checkvar_name"); result_checkvar_value = (MWNumericArray)result_checker.GetField("checkvar_value"); result_checkvar_unit = (MWCharArray)result_checker.GetField("checkvar_unit"); result_adjust = (MWNumericArray)result_checker.GetField("adjust"); result_adjust_unit = (MWCharArray)result_checker.GetField("adjust_unit"); result_out = "\n" + result_type.ToString() + " STATUS : " + result_state.ToString(); result_out += "\n" + result_checkvar_name.ToString() + " : " + result_checkvar_value.ToString() + " " + result_checkvar_unit.ToString(); result_out += "\n" + "ADJUST : " + result_adjust.ToString() + " " + result_adjust_unit.ToString(); Console.WriteLine(result_out); break; } // end of switch statement } return(result_out); }