public void DetectOrientationThread(object s) { int counter = 0; int start = (int)s; for (int i = start; i < _mts.text_string_list.Count; i += _tnum) { if (_mts.text_string_list[i].char_list.Count > 2) { double avg_size = 0; for (int j = 0; j < _mts.text_string_list[i].char_list.Count; j++) { avg_size += _mts.text_string_list[i].char_list[j].bbx.Width + _mts.text_string_list[i].char_list[j].bbx.Height; } counter++; avg_size /= (double)(_mts.text_string_list[i].char_list.Count * 2); MultiThreadsSkewnessDetection mtsd = new MultiThreadsSkewnessDetection(); int[] idx = mtsd.Apply(1, _mts.text_string_list[i].srcimg, (int)avg_size, 0, 180, 3); if (idx[0] <= 90) { _mts.text_string_list[i].orientation_list.Add(idx[0]); _mts.text_string_list[i].rotated_img_list.Add((Bitmap)mtsd.rotatedimg_table[idx[0]]); if (GeometryUtils.DiffSlope(idx[0], 90) < 5) { _mts.text_string_list[i].orientation_list.Add(idx[1]); _mts.text_string_list[i].rotated_img_list.Add((Bitmap)mtsd.rotatedimg_table[idx[1]]); } } else { _mts.text_string_list[i].orientation_list.Add(idx[1]); _mts.text_string_list[i].rotated_img_list.Add((Bitmap)mtsd.rotatedimg_table[idx[1]]); if (GeometryUtils.DiffSlope(idx[1], 270) < 5) { _mts.text_string_list[i].orientation_list.Add(idx[0]); _mts.text_string_list[i].rotated_img_list.Add((Bitmap)mtsd.rotatedimg_table[idx[0]]); } } } } }