20 static ossimTrace traceDebug(
"ossimVertexExtractor:debug");
43 <<
"\nNULL input image source passed to constructor!" 68 static const char MODULE[] =
"ossimVertexExtractor::execute";
70 if (traceDebug())
CLOG <<
" Entered..." << endl;
75 <<
"\nOutput file name is empty. Use setFilename method..." 83 <<
"\nArea of interest is not set. Use setAreaOfInterest method..." 84 <<
"\nDefaulting to bounding rectangle of input source." 110 if (traceDebug())
CLOG <<
" Exited..." << endl;
117 static const char MODULE[] =
"ossimVertexExtractor::scanForEdges";
119 if (traceDebug())
CLOG <<
" Entered..." << endl;
125 <<
"WARN ossimVertexExtractor::scanForEdges():" 126 <<
"\nInput source is null. Returning..." << std::endl;
152 double tiles_processed = 0.0;
164 for (
ossim_int32 line = START_LINE; line < STOP_LINE; line += TILE_HEIGHT)
167 const ossim_int32 STOP_INDEX = ( (line+TILE_HEIGHT-1) < STOP_LINE ) ?
168 (START_INDEX+TILE_HEIGHT-1) :
170 const ossim_int32 TILE_LINE_STOP = ((line+TILE_HEIGHT-1) < STOP_LINE) ?
171 (line+TILE_HEIGHT-1) : STOP_LINE;
174 bool all_edges_found =
true;
175 for (
ossim_int32 i = START_INDEX; i <= STOP_INDEX; ++i)
179 all_edges_found =
false;
185 if (all_edges_found ==
false)
191 for (
ossim_int32 samp = START_SAMP; samp < STOP_SAMP; samp += TILE_WIDTH)
204 const ossim_int32 TILE_SAMP_STOP = ((samp+TILE_WIDTH-1) < STOP_SAMP) ?
205 (samp+TILE_WIDTH-1) : STOP_SAMP;
227 all_edges_found =
true;
228 for (
ossim_int32 i = START_INDEX; i <= STOP_INDEX; ++i)
232 all_edges_found =
false;
238 if (all_edges_found ==
false)
247 TILE_WIDTH)*TILE_WIDTH);
250 for (
ossim_int32 samp = END_TILE_X; samp >= START_SAMP; samp -= TILE_WIDTH)
263 const ossim_int32 TILE_SAMP_STOP = ((samp+TILE_WIDTH-1) < STOP_SAMP) ?
264 (samp+TILE_WIDTH-1) : STOP_SAMP;
288 tiles_processed += 1.0;
296 CLOG <<
"DEBUG:" << endl;
301 <<
" right[" << i <<
"]: " 319 static const char MODULE[] =
"ossimVertexExtractor::extractVertices";
321 if (traceDebug())
CLOG <<
" Entered..." << endl;
326 <<
"\nEdges not initialized!" << std::endl;
360 bool found_first_non_null_line = 0;
361 bool found_last_non_null_line = 0;
363 bool rhombus =
false;
372 while(found_last_non_null_line == 0)
378 && (found_first_non_null_line == 0) )
381 found_first_non_null_line = 1;
382 first_non_null_line = i;
385 while( (found_first_non_null_line == 1)
387 && (found_last_non_null_line == 0)
388 && (i <= total_lines) )
392 found_last_non_null_line = 1;
393 last_non_null_line = i-1;
400 last_non_null_line = last_non_null_line -1;
402 topLine = first_non_null_line;
403 bottomLine = last_non_null_line;
409 ossim_int32 sizeDeltaSlope = last_non_null_line - first_non_null_line;
410 double* rightSlope =
new double[sizeDeltaSlope];
412 for(
ossim_int32 i = start; i <= (end - 100); i += 100)
417 rightSlope[k] = 100.0 / run;
428 CLOG <<
"DEBUG:" << endl;
439 double* leftSlope =
new double[sizeDeltaSlope];
441 for(
ossim_int32 i = start; i <= (end - 100); i += 100)
446 leftSlope[k] = 100.0 / run;
457 CLOG <<
"DEBUG:" << endl;
478 rightMostEdgeTempLine = i;
481 rightMostSample = rightMostEdgeTemp;
482 rightMostSampleLine = rightMostEdgeTempLine-1;
494 leftMostEdgeTempLine = i;
497 leftMostSample = leftMostEdgeTemp;
498 leftMostSampleLine = leftMostEdgeTempLine-1;
504 if(leftSlope[i]==rightSlope[i])
506 counter = counter + 1;
510 if(counter == sizeOftheSlope)
519 leftCornerLine_A = topLine;
521 leftCorner_A = leftMostSample;
523 rightCornerLine_A = topLine;
525 rightCorner_A = rightMostSample;
527 rightCornerLine_B = bottomLine;
529 rightCorner_B = rightMostSample;
531 leftCornerLine_B = bottomLine;
533 leftCorner_B = leftMostSample;
541 ossim_int32 halfsamps = (rightMostSample - leftMostSample ) / 2;
545 if( (firstRightSample - firstLeftSample) > halfsamps )
556 leftCornerLine_A = topLine;
557 leftCorner_A = firstLeftSample;
559 rightCornerLine_A = topLine;
560 rightCorner_A= firstRightSample;
562 rightCornerLine_B = bottomLine;
563 rightCorner_B = lastRightSample;
565 leftCornerLine_B = bottomLine;
566 leftCorner_B = lastLeftSample;
572 if(
square == 0 && rhombus == 0)
575 if(firstLeftSample < lastLeftSample)
600 double line1RegPtsSamples[] = {
static_cast<double>(
theRightEdge[line1_pt1]),
603 double line1RegPtsLines[] = {
static_cast<double>(-line1_pt1),
604 static_cast<double>(-line1_pt2),
605 static_cast<double>(-line1_pt3) };
607 double sum_xy_line1 = 0.0;
608 double sum_x_line1 = 0.0;
609 double sum_y_line1 = 0.0;
610 double mean_x_line1 = 0.0;
611 double mean_y_line1 = 0.0;
612 double sum_x_squared_line1 = 0.0;
613 double sum_squared_x_line1 = 0.0;
616 double num_elements_line1 = 3.0;
618 for(
ossim_int32 i = 0; i < num_elements_line1; ++i)
620 sum_xy_line1 = sum_xy_line1
621 + (line1RegPtsSamples[i]*line1RegPtsLines[i]);
623 sum_x_line1 = sum_x_line1 + line1RegPtsSamples[i];
624 sum_y_line1 = sum_y_line1 + line1RegPtsLines[i];
626 sum_squared_x_line1 = sum_squared_x_line1
627 + line1RegPtsSamples[i]*line1RegPtsSamples[i];
630 sum_x_squared_line1 = sum_x_line1*sum_x_line1;
631 mean_y_line1 = sum_y_line1/num_elements_line1;
632 mean_x_line1 = sum_x_line1/num_elements_line1;
633 b_line1 = (sum_xy_line1 - (sum_x_line1*sum_y_line1)/num_elements_line1)
634 / (sum_squared_x_line1 - (sum_x_squared_line1/num_elements_line1));
635 a_line1 = mean_y_line1 - b_line1*mean_x_line1;
643 for(
ossim_int32 i = 0; i < num_elements_line1; ++i)
647 <<
"]: " <<line1RegPtsLines[i]
648 <<
"\nline1RegPtsSamples[" << i <<
"]: " 649 <<line1RegPtsSamples[i]
667 minValuePt1, minOffsetPt1 );
668 line2_pt1 = line2_pt1-100 + minOffsetPt1;
674 minValuePt2, minOffsetPt2 );
675 line2_pt2 = line2_pt2-100 + minOffsetPt2;
681 minValuePt3, minOffsetPt3 );
682 line2_pt3 = line2_pt3-100 + minOffsetPt3;
688 double line2RegPtsSamples[] = {
static_cast<double>(
theRightEdge[line2_pt1]),
691 double line2RegPtsLines[] = {
static_cast<double>(-line2_pt1),
692 static_cast<double>(-line2_pt2),
693 static_cast<double>(-line2_pt3) };
695 double sum_xy_line2 = 0.0;
696 double sum_x_line2 = 0.0;
697 double sum_y_line2 = 0.0;
698 double mean_x_line2 = 0.0;
699 double mean_y_line2 = 0.0;
700 double sum_x_squared_line2 = 0.0;
701 double sum_squared_x_line2 = 0.0;
704 double num_elements_line2 = 3.0;
706 for(
ossim_int32 i = 0; i < num_elements_line2; ++i)
708 sum_xy_line2 = sum_xy_line2
709 + (line2RegPtsSamples[i]*line2RegPtsLines[i]);
711 sum_x_line2 = sum_x_line2 + line2RegPtsSamples[i];
712 sum_y_line2 = sum_y_line2 + line2RegPtsLines[i];
714 sum_squared_x_line2 = sum_squared_x_line2
715 + line2RegPtsSamples[i]*line2RegPtsSamples[i];
718 sum_x_squared_line2 = sum_x_line2*sum_x_line2;
719 mean_y_line2 = sum_y_line2/num_elements_line2;
720 mean_x_line2 = sum_x_line2/num_elements_line2;
721 b_line2 = (sum_xy_line2 - (sum_x_line2*sum_y_line2)/num_elements_line2)
722 / (sum_squared_x_line2 - (sum_x_squared_line2/num_elements_line2));
723 a_line2 = mean_y_line2 - b_line2*mean_x_line2;
727 for(
ossim_int32 i = 0; i < num_elements_line2; ++i)
730 <<line2RegPtsLines[i]
731 <<
"\nline2RegPtsSamples[" << i <<
"]: " 732 <<line2RegPtsSamples[i]
736 <<
"\nb_line2: " << b_line2 << std::endl;
744 double ur_x = (a_line1 - a_line2)/(b_line2 - b_line1);
745 double ur_y = -(a_line1 + b_line1*ur_x);
755 double line3RegPtsSamples[] = {
static_cast<double>(
theLeftEdge[line3_pt1]),
758 double line3RegPtsLines[] = {
static_cast<double>(-line3_pt1),
759 static_cast<double>(-line3_pt2),
760 static_cast<double>(-line3_pt3) };
762 double sum_xy_line3 = 0.0;
763 double sum_x_line3 = 0.0;
764 double sum_y_line3 = 0.0;
765 double mean_x_line3 = 0.0;
766 double mean_y_line3 = 0.0;
767 double sum_x_squared_line3 = 0.0;
768 double sum_squared_x_line3 = 0.0;
771 double num_elements_line3 = 3.0;
773 for(
ossim_int32 i = 0; i < num_elements_line3; ++i)
775 sum_xy_line3 = sum_xy_line3
776 + (line3RegPtsSamples[i]*line3RegPtsLines[i]);
778 sum_x_line3 = sum_x_line3 + line3RegPtsSamples[i];
779 sum_y_line3 = sum_y_line3 + line3RegPtsLines[i];
781 sum_squared_x_line3 = sum_squared_x_line3
782 + line3RegPtsSamples[i]*line3RegPtsSamples[i];
786 sum_x_squared_line3 = sum_x_line3*sum_x_line3;
787 mean_y_line3 = sum_y_line3/num_elements_line3;
788 mean_x_line3 = sum_x_line3/num_elements_line3;
789 b_line3 = (sum_xy_line3 - (sum_x_line3*sum_y_line3)/num_elements_line3)
790 / (sum_squared_x_line3 - (sum_x_squared_line3/num_elements_line3));
791 a_line3 = mean_y_line3 - b_line3*mean_x_line3;
799 for(
ossim_int32 i = 0; i < num_elements_line3; ++i)
803 <<line3RegPtsLines[i]
804 <<
"\nline3RegPtsSamples[" << i <<
"]: " 805 <<line3RegPtsSamples[i]
813 double lr_x = (a_line3 - a_line2)/(b_line2 - b_line3);
814 double lr_y = -(a_line3 + b_line3*lr_x);
834 maxValueLine4Pt1, maxOffsetLine4Pt1 );
835 line4_pt1 = line4_pt1-100 + maxOffsetLine4Pt1;
841 maxValueLine4Pt2, maxOffsetLine4Pt2 );
842 line4_pt2 = line4_pt2-100 + maxOffsetLine4Pt2;
848 maxValueLine4Pt3, maxOffsetLine4Pt3 );
849 line4_pt3 = line4_pt3-100 + maxOffsetLine4Pt3;
854 double line4RegPtsSamples[] = {
static_cast<double>(
theLeftEdge[line4_pt1]),
857 double line4RegPtsLines[] = {
static_cast<double>(-line4_pt1),
858 static_cast<double>(-line4_pt2),
859 static_cast<double>(-line4_pt3) };
861 double sum_xy_line4 = 0.0;
862 double sum_x_line4 = 0.0;
863 double sum_y_line4 = 0.0;
864 double mean_x_line4 = 0.0;
865 double mean_y_line4 = 0.0;
866 double sum_x_squared_line4 = 0.0;
867 double sum_squared_x_line4 = 0.0;
870 double num_elements_line4 = 3.0;
871 for(
ossim_int32 i = 0; i < num_elements_line4; ++i)
873 sum_xy_line4 = sum_xy_line4
874 + (line4RegPtsSamples[i]*line4RegPtsLines[i]);
876 sum_x_line4 = sum_x_line4 + line4RegPtsSamples[i];
877 sum_y_line4 = sum_y_line4 + line4RegPtsLines[i];
879 sum_squared_x_line4 = sum_squared_x_line4
880 + line4RegPtsSamples[i]*line4RegPtsSamples[i];
885 sum_x_squared_line4 = sum_x_line4*sum_x_line4;
886 mean_y_line4 = sum_y_line4/num_elements_line4;
887 mean_x_line4 = sum_x_line4/num_elements_line4;
888 b_line4 = (sum_xy_line4 - (sum_x_line4*sum_y_line4)/num_elements_line4)
889 / (sum_squared_x_line4 - (sum_x_squared_line4/num_elements_line4));
890 a_line4 = mean_y_line4 - b_line4*mean_x_line4;
895 <<
"\nb_line4: "<< b_line4 <<std::endl;
897 for(
ossim_int32 i = 0; i < num_elements_line4; ++i)
901 <<line4RegPtsLines[i]
902 <<
"\nline4RegPtsSamples[" << i <<
"]: " 903 <<line4RegPtsSamples[i]
912 double ll_x = (a_line4 - a_line3)/(b_line3 - b_line4);
913 double ll_y = -(a_line4 + b_line4*ll_x);
919 double ul_x = (a_line4 - a_line1)/(b_line1 - b_line4);
920 double ul_y = -(a_line4 + b_line4*ul_x);
925 <<
"\ncorner0: ("<<ul_x<<
", "<<ul_y<<
")" 926 <<
"\ncorner1: ("<<ur_x<<
", "<<ur_y<<
")" 927 <<
"\ncorner2: ("<<lr_x<<
", "<<lr_y<<
")" 928 <<
"\ncorner3: ("<<ll_x<<
", "<<ll_y<<
")"<<std::endl<<std::endl;
958 if( (leftCornerLine_A < (topLine - 300))
959 || (leftCornerLine_A > total_lines)
960 || (leftCorner_A > rightMostSample)
961 || (leftCorner_A < leftMostSample)
963 || (rightCornerLine_A < topLine)
964 || (rightCornerLine_A > bottomLine)
965 || (rightCorner_A < leftMostSample)
966 || (rightCorner_A > (rightMostSample + 200))
969 || (rightCornerLine_B < topLine)
970 || (rightCornerLine_B > (bottomLine + 200))
971 || (rightCorner_B < leftMostSample)
972 || (rightCorner_B > rightMostSample)
974 || (leftCornerLine_B > bottomLine)
975 || (leftCornerLine_B < topLine)
976 || (leftCorner_B > rightMostSample)
977 || (leftCorner_B < (leftMostSample - 200)) )
991 if(firstRightSample > lastRightSample)
1011 ossim_int32 line1_pt2 = (line1_pt0 + line1_pt4)/2;
1012 ossim_int32 line1_pt1 = (line1_pt2 + line1_pt0)/2;
1013 ossim_int32 line1_pt3 = (line1_pt2 + line1_pt4)/2;
1026 minValueLine1Pt1, minOffsetLine1Pt1 );
1027 line1_pt1 = line1_pt1-100 + minOffsetLine1Pt1;
1032 <<
" minValueLine1Pt1: "<<minValueLine1Pt1<<
"\n\n";
1038 minValueLine1Pt2, minOffsetLine1Pt2 );
1039 line1_pt2 = line1_pt2-100 + minOffsetLine1Pt2;
1044 <<
" minValueLine1Pt2: "<<minValueLine1Pt2<<
"\n\n";
1051 minValueLine1Pt3, minOffsetLine1Pt3 );
1052 line1_pt3 = line1_pt3-100 + minOffsetLine1Pt3;
1057 <<
" minValueLine1Pt3: "<<minValueLine1Pt3<<std::endl<<std::endl;
1060 double line1RegPtsSamples[] = {
static_cast<double>(
theRightEdge[line1_pt1]),
1063 double line1RegPtsLines[] = {
static_cast<double>(-line1_pt1),
1064 static_cast<double>(-line1_pt2),
1065 static_cast<double>(-line1_pt3) };
1067 double sum_xy_line1 = 0.0;
1068 double sum_x_line1 = 0.0;
1069 double sum_y_line1 = 0.0;
1070 double mean_x_line1 = 0.0;
1071 double mean_y_line1 = 0.0;
1072 double sum_x_squared_line1 = 0.0;
1073 double sum_squared_x_line1 = 0.0;
1076 double num_elements_line1 = 3.0;
1078 for(
ossim_int32 i = 0; i < num_elements_line1; ++i)
1080 sum_xy_line1 = sum_xy_line1
1081 + (line1RegPtsSamples[i]*line1RegPtsLines[i]);
1083 sum_x_line1 = sum_x_line1 + line1RegPtsSamples[i];
1084 sum_y_line1 = sum_y_line1 + line1RegPtsLines[i];
1086 sum_squared_x_line1 = sum_squared_x_line1
1087 + line1RegPtsSamples[i]*line1RegPtsSamples[i];
1092 sum_x_squared_line1 = sum_x_line1*sum_x_line1;
1093 mean_y_line1 = sum_y_line1/num_elements_line1;
1094 mean_x_line1 = sum_x_line1/num_elements_line1;
1095 b_line1 = (sum_xy_line1 - (sum_x_line1*sum_y_line1)/num_elements_line1)
1096 / (sum_squared_x_line1 - (sum_x_squared_line1/num_elements_line1));
1097 a_line1 = mean_y_line1 - b_line1*mean_x_line1;
1102 <<
"\nb_line1: "<< b_line1 <<std::endl;
1104 for(
ossim_int32 i = 0; i < num_elements_line1; ++i)
1108 <<line1RegPtsLines[i]
1109 <<
"\nline1RegPtsSamples[" << i <<
"]: " 1110 <<line1RegPtsSamples[i]
1120 ossim_int32 line2_pt2 = (line2_pt0 + line2_pt4)/2;
1121 ossim_int32 line2_pt1 = (line2_pt2 + line2_pt0)/2;
1122 ossim_int32 line2_pt3 = (line2_pt2 + line2_pt4)/2;
1124 double line2RegPtsSamples[] = {
static_cast<double>(
theRightEdge[line2_pt1]),
1127 double line2RegPtsLines[] = {
static_cast<double>(-line2_pt1),
1128 static_cast<double>(-line2_pt2),
1129 static_cast<double>(-line2_pt3) };
1131 double sum_xy_line2 = 0.0;
1132 double sum_x_line2 = 0.0;
1133 double sum_y_line2 = 0.0;
1134 double mean_x_line2 = 0.0;
1135 double mean_y_line2 = 0.0;
1136 double sum_x_squared_line2 = 0.0;
1137 double sum_squared_x_line2 = 0.0;
1140 double num_elements_line2 = 3.0;
1141 for(
ossim_int32 i = 0; i < num_elements_line2; ++i)
1143 sum_xy_line2 = sum_xy_line2
1144 + (line2RegPtsSamples[i]*line2RegPtsLines[i]);
1146 sum_x_line2 = sum_x_line2 + line2RegPtsSamples[i];
1147 sum_y_line2 = sum_y_line2 + line2RegPtsLines[i];
1149 sum_squared_x_line2 = sum_squared_x_line2
1150 + line2RegPtsSamples[i]*line2RegPtsSamples[i];
1153 sum_x_squared_line2 = sum_x_line2*sum_x_line2;
1154 mean_y_line2 = sum_y_line2/num_elements_line2;
1155 mean_x_line2 = sum_x_line2/num_elements_line2;
1156 b_line2 = (sum_xy_line2 - (sum_x_line2*sum_y_line2)/num_elements_line2)
1157 / (sum_squared_x_line2 - (sum_x_squared_line2/num_elements_line2));
1158 a_line2 = mean_y_line2 - b_line2*mean_x_line2;
1163 <<
"\nb_line2: "<< b_line2 <<std::endl;
1165 for(
ossim_int32 i = 0; i < num_elements_line2; ++i)
1169 <<line2RegPtsLines[i]
1170 <<
"\nline2RegPtsSamples[" << i <<
"]: " 1171 <<line2RegPtsSamples[i]
1179 double lr_x = (a_line1 - a_line2)/(b_line2 - b_line1);
1180 double lr_y = -(a_line1 + b_line1*lr_x);
1186 ossim_int32 line3_pt2 = (line3_pt0 + line3_pt4)/2;
1187 ossim_int32 line3_pt1 = (line3_pt2 + line3_pt0)/2;
1188 ossim_int32 line3_pt3 = (line3_pt2 + line3_pt4)/2;
1193 maxValueLine3Pt1, maxOffsetLine3Pt1 );
1194 line3_pt1 = line3_pt1-100 + maxOffsetLine3Pt1;
1200 maxValueLine3Pt2, maxOffsetLine3Pt2 );
1201 line3_pt2 = line3_pt2-100 + maxOffsetLine3Pt2;
1207 maxValueLine3Pt3, maxOffsetLine3Pt3 );
1208 line3_pt3 = line3_pt3-100 + maxOffsetLine3Pt3;
1211 double line3RegPtsSamples[] = {
static_cast<double>(
theLeftEdge[line3_pt1]),
1214 double line3RegPtsLines[] = {
static_cast<double>(-line3_pt1),
1215 static_cast<double>(-line3_pt2),
1216 static_cast<double>(-line3_pt3) };
1218 double sum_xy_line3 = 0.0;
1219 double sum_x_line3 = 0.0;
1220 double sum_y_line3 = 0.0;
1221 double mean_x_line3 = 0.0;
1222 double mean_y_line3 = 0.0;
1223 double sum_x_squared_line3 = 0.0;
1224 double sum_squared_x_line3 = 0.0;
1227 double num_elements_line3 = 3.0;
1228 for(
ossim_int32 i = 0; i < num_elements_line3; ++i)
1230 sum_xy_line3 = sum_xy_line3
1231 + (line3RegPtsSamples[i]*line3RegPtsLines[i]);
1233 sum_x_line3 = sum_x_line3 + line3RegPtsSamples[i];
1234 sum_y_line3 = sum_y_line3 + line3RegPtsLines[i];
1236 sum_squared_x_line3 = sum_squared_x_line3
1237 + line3RegPtsSamples[i]*line3RegPtsSamples[i];
1242 sum_x_squared_line3 = sum_x_line3*sum_x_line3;
1243 mean_y_line3 = sum_y_line3/num_elements_line3;
1244 mean_x_line3 = sum_x_line3/num_elements_line3;
1245 b_line3 = (sum_xy_line3 - (sum_x_line3*sum_y_line3)/num_elements_line3)
1246 / (sum_squared_x_line3 - (sum_x_squared_line3/num_elements_line3));
1247 a_line3 = mean_y_line3 - b_line3*mean_x_line3;
1252 <<
" b_line3: "<< b_line3 <<endl;
1253 for(
ossim_int32 i = 0; i < num_elements_line3; ++i)
1257 << line3RegPtsLines[i]
1258 <<
"\nline3RegPtsSamples[" << i <<
"]: " 1259 << line3RegPtsSamples[i]
1267 double ll_x = (a_line3 - a_line2)/(b_line2 - b_line3);
1268 double ll_y = -(a_line3 + b_line3*ll_x);
1276 ossim_int32 line4_pt2 = (line4_pt0 + line4_pt4)/2;
1277 ossim_int32 line4_pt1 = (line4_pt2 + line4_pt0)/2;
1278 ossim_int32 line4_pt3 = (line4_pt2 + line4_pt4)/2;
1281 double line4RegPtsSamples[] = {
static_cast<double>(
theLeftEdge[line4_pt1]),
1284 double line4RegPtsLines[] = {
static_cast<double>(-line4_pt1),
1285 static_cast<double>(-line4_pt2),
1286 static_cast<double>(-line4_pt3) };
1288 double sum_xy_line4 = 0.0;
1289 double sum_x_line4 = 0.0;
1290 double sum_y_line4 = 0.0;
1291 double mean_x_line4 = 0.0;
1292 double mean_y_line4 = 0.0;
1293 double sum_x_squared_line4 = 0.0;
1294 double sum_squared_x_line4 = 0.0;
1297 double num_elements_line4 = 3.0;
1298 for(
ossim_int32 i = 0; i < num_elements_line4; ++i)
1300 sum_xy_line4 = sum_xy_line4
1301 + (line4RegPtsSamples[i]*line4RegPtsLines[i]);
1303 sum_x_line4 = sum_x_line4 + line4RegPtsSamples[i];
1304 sum_y_line4 = sum_y_line4 + line4RegPtsLines[i];
1306 sum_squared_x_line4 = sum_squared_x_line4
1307 + line4RegPtsSamples[i]*line4RegPtsSamples[i];
1312 sum_x_squared_line4 = sum_x_line4*sum_x_line4;
1313 mean_y_line4 = sum_y_line4/num_elements_line4;
1314 mean_x_line4 = sum_x_line4/num_elements_line4;
1315 b_line4 = (sum_xy_line4 - (sum_x_line4*sum_y_line4)/num_elements_line4)
1316 / (sum_squared_x_line4 - (sum_x_squared_line4/num_elements_line4));
1317 a_line4 = mean_y_line4 - b_line4*mean_x_line4;
1324 for(
ossim_int32 i = 0; i < num_elements_line4; ++i)
1327 <<line4RegPtsLines[i]
1328 <<
"\nline4RegPtsSamples[" << i <<
"]: " 1329 <<line4RegPtsSamples[i]
1338 double ul_x = (a_line4 - a_line3)/(b_line3 - b_line4);
1339 double ul_y = -(a_line4 + b_line4*ul_x);
1344 double ur_x = (a_line4 - a_line1)/(b_line1 - b_line4);
1345 double ur_y = -(a_line4 + b_line4*ur_x);
1350 <<
"\ncorner0: ("<<ul_x<<
", "<<ul_y<<
")" 1351 <<
"\ncorner1: ("<<ur_x<<
", "<<ur_y<<
")" 1352 <<
"\ncorner2: ("<<lr_x<<
", "<<lr_y<<
")" 1353 <<
"\ncorner3: ("<<ll_x<<
", "<<ll_y<<
")" <<std::endl;
1381 if( (leftCornerLine_A > bottomLine)
1382 || (leftCornerLine_A < topLine)
1383 || (leftCorner_A > rightMostSample)
1384 || (leftCorner_A < (leftMostSample - 300))
1386 || (rightCornerLine_A < (topLine - 300))
1387 || (rightCornerLine_A > total_lines)
1388 || (rightCorner_A > rightMostSample)
1389 || (rightCorner_A < leftMostSample)
1392 || (rightCornerLine_B < topLine)
1393 || (rightCornerLine_B > bottomLine)
1394 || (rightCorner_B < leftMostSample)
1395 || (rightCorner_B > (rightMostSample + 200))
1397 || (leftCornerLine_B > (bottomLine + 200))
1398 || (leftCornerLine_B < topLine)
1399 || (leftCorner_B < leftMostSample)
1400 || (leftCorner_B > rightMostSample) )
1413 if( (
square == 0) && (rhombus == 0) && (right == 0) && (left == 0))
1421 leftCornerLine_A = (topLine);
1422 leftCorner_A =(leftMostSample);
1427 bool foundULcornera =
false;
1428 bool foundULcornerb =
false;
1451 foundULcornera =
true;
1454 leftCornerLine_A = line;
1455 leftCorner_A = samp;
1456 tempLine_corner0a = line;
1457 tempSamp_corner0a = samp;
1462 <<
"\nFound non null in ul corner pass 1 "<<std::endl
1463 <<
"line: "<<line<<std::endl
1464 <<
"samp: "<<samp<<std::endl;
1467 if(foundULcornera ==
true){
break;}
1469 if(foundULcornera ==
true){
break;}
1483 foundULcornerb =
true;
1486 leftCornerLine_A = line;
1487 leftCorner_A = samp;
1488 tempLine_corner0b = line;
1489 tempSamp_corner0b = samp;
1494 <<
"\nFound non null in ul corner pass 2 "<<std::endl
1495 <<
"line: "<<line<<std::endl
1496 <<
"samp: "<<samp<<std::endl;
1499 if(foundULcornerb ==
true){
break;}
1501 if(foundULcornerb ==
true){
break;}
1505 if(foundULcornerb ==
true && foundULcornera ==
true)
1507 leftCornerLine_B = (tempLine_corner0a + tempLine_corner0b)/2;
1508 leftCorner_B = (tempSamp_corner0a + tempSamp_corner0b)/2;
1513 rightCornerLine_A = (topLine);
1514 rightCorner_A = (rightMostSample);
1520 bool foundURcornera =
false;
1521 bool foundURcornerb =
false;
1523 ossimIrect tileRectUR((rightMostSample - 50),
1544 foundURcornera =
true;
1545 rightCornerLine_A = line;
1546 rightCorner_A = samp;
1547 tempLine_corner1a = line;
1548 tempSamp_corner1a = samp;
1553 <<
"\nFound non null in ur corner pass 1 "<<std::endl
1554 <<
"line: "<<line<<std::endl
1555 <<
"samp: "<<samp<<std::endl;
1558 if(foundURcornera ==
true){
break;}
1560 if(foundURcornera ==
true){
break;}
1575 foundURcornerb =
true;
1576 rightCornerLine_A = line;
1577 rightCorner_A = samp;
1578 tempLine_corner1b = line;
1579 tempSamp_corner1b = samp;
1584 <<
"\nFound non null in ur corner pass 2 "<<std::endl
1585 <<
"line: "<<line<<std::endl
1586 <<
"samp: "<<samp<<std::endl;
1589 if(foundURcornerb ==
true){
break;}
1591 if(foundURcornerb ==
true){
break;}
1595 if(foundURcornerb ==
true && foundURcornera ==
true)
1597 rightCornerLine_B = (tempLine_corner1a + tempLine_corner1b)/2;
1598 rightCorner_B = (tempSamp_corner1a + tempSamp_corner1b)/2;
1602 rightCornerLine_B = (bottomLine);
1603 rightCorner_B = (rightMostSample);
1610 bool foundLRcornera =
false;
1611 bool foundLRcornerb =
false;
1613 ossimIrect tileRectLR((rightMostSample - 50),
1634 foundLRcornera =
true;
1635 rightCornerLine_B = line;
1636 rightCorner_B = samp;
1637 tempLine_corner2a = line;
1638 tempSamp_corner2a = samp;
1643 <<
"\nFound non null in lr corner pass 1 "<<std::endl
1644 <<
"line: "<<line<<std::endl
1645 <<
"samp: "<<samp<<std::endl;
1648 if(foundLRcornera ==
true){
break;}
1650 if(foundLRcornera ==
true){
break;}
1664 foundLRcornerb =
true;
1665 rightCornerLine_B = line;
1666 rightCorner_B = samp;
1667 tempLine_corner2b = line;
1668 tempSamp_corner2b = samp;
1673 <<
"\nFound non null in lr corner pass 2"<<std::endl
1674 <<
"line: "<<line<<std::endl
1675 <<
"samp: "<<samp<<std::endl;
1678 if(foundLRcornerb ==
true){
break;}
1680 if(foundLRcornerb ==
true){
break;}
1683 if(foundLRcornerb ==
true && foundLRcornera ==
true)
1685 rightCornerLine_B = (tempLine_corner2a + tempLine_corner2b)/2;
1686 rightCorner_B = (tempSamp_corner2a + tempSamp_corner2b)/2;
1689 leftCornerLine_B = (bottomLine);
1690 leftCorner_B = (leftMostSample);
1697 bool foundLLcornera =
false;
1698 bool foundLLcornerb =
false;
1702 (leftMostSample +50),
1723 foundLLcornera =
true;
1724 leftCornerLine_B = line;
1725 leftCorner_B = samp;
1726 tempLine_corner3a = line;
1727 tempSamp_corner3a = samp;
1732 <<
"\nFound non null in ll corner pass 1"<<std::endl
1733 <<
"line: "<<line<<std::endl
1734 <<
"samp: "<<samp<<std::endl;
1737 if(foundLLcornera ==
true){
break;}
1739 if(foundLLcornera ==
true){
break;}
1756 foundLLcornerb =
true;
1757 leftCornerLine_B = line;
1758 leftCorner_B = samp;
1759 tempLine_corner3b = line;
1760 tempSamp_corner3b = samp;
1765 <<
"\nFound non null in ll corner pass 2 "<<std::endl
1766 <<
"line: "<<line<<std::endl
1767 <<
"samp: "<<samp<<std::endl;
1770 if(foundLLcornerb ==
true){
break;}
1772 if(foundLLcornerb ==
true){
break;}
1776 if(foundLLcornerb ==
true && foundLLcornera ==
true)
1778 leftCornerLine_B = (tempLine_corner3a + tempLine_corner3b)/2;
1779 leftCorner_B = (tempSamp_corner3a + tempSamp_corner3b)/2;
1798 delete [] leftSlope;
1803 delete [] rightSlope;
1810 <<
"\nleftMostSampleLine: " << leftMostSampleLine
1811 <<
"\n\nrightMostSample: " << rightMostSample
1812 <<
"\nrightMostSampleLine: " << rightMostSampleLine
1814 <<
"\n\nfirstLeftSample: " << firstLeftSample
1815 <<
"\nfirstRightSample: " << firstRightSample
1817 <<
"\n\nlastLeftSample: " << lastLeftSample
1818 <<
"\nlastRightSample: " << lastRightSample
1820 <<
"\n\ntopLine: " << topLine
1821 <<
"\nbottomLine: " << bottomLine
1822 <<
"\ntotal_lines: " << total_lines
1828 <<
"\n\nreturning..." << std::endl;
1836 static const char MODULE[] =
"ossimVertexExtractor::writeVertices";
1838 if (traceDebug())
CLOG <<
" Entered..." << endl;
1843 if (!
open())
return false;
1893 <<
"\nOutput file has not been set. Call setFilename() method..." 1918 if(*start < minValue)
1922 offsetFromStart = currentOffset;
1939 if(*start > maxValue)
1942 offsetFromStart = currentOffset;
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
ossim_uint32 height() const
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
const ossimIpt & ul() const
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual void setProcessStatus(ossimProcessStatus processStatus)
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
virtual void setOutputName(const ossimString &outputName)
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
bool isNull(ossim_uint32 offset) const
const ossimIpt & lr() const
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
ossim_uint32 width() const
const ossimIpt & ur() const
This class defines an abstract Handler which all image handlers(loaders) should derive from...
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
std::basic_ofstream< char > ofstream
Class for char output file streams.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)