Example Contour Refinement Usage: ExampleRefineContour SegmentedImage ColorImage ContourImage
#include <Filter/FilterNTo2N.hh>
#include <Filter/GradientSobel3x3.hh>
#include <Filter/GradientGauss.hh>
#include <Filter/GradientGaussAsymmetric.hh>
#include <Base/Image/ImageIO.hh>
#include <Base/Image/ImageConvert.hh>
#include <Base/Debug/TimeMeasure.hh>
#include <math.h>
#include <Base/ImageUtils/ImageDraw.hh>
#include "FeatureDetector/ContourDetectorSimple.hh"
#include <Base/Common/BIASpragma.hh>
using namespace BIAS;
using namespace std;
#define InputImageType unsigned char
#define OutputImageType float
int main(int argc, char *argv[])
{
if(argc < 4){
cerr << "usage: "<< argv[0] << "SegmentedImage ColorImage ContourImage" << endl;
exit(0);
}
std::vector<BIASContour> contour;
grad = &ggauss;
OutputImageType>::TBH_valid);
gsobel3x3.
Filter(im, gx, gy, g);
int dSearchLength = 20;
double start_x, start_y, end_x, end_y;
for(
unsigned int i = 0; i < ct.
length; i++){
start_x = pointS[0];
start_y = pointS[1];
end_x = pointE[0];
end_y = pointE[1];
double distance = sqrt(pow((end_x - start_x),2) +
pow((end_y - start_y),2));
double PvectorXone = (end_y - start_y);
double PvectorYone = -(end_x - start_x);
double coefficient = dSearchLength / distance;
double normX = coefficient*PvectorXone;
int x,y;
int fk = 1;
bool found = false;
while((normX+pointMiddle[0]) - (pointMiddle[0] + PvectorXone*fk) > 0 ){
x = pointMiddle[0] + PvectorXone*fk;
y = pointMiddle[1] + PvectorYone*fk;
if(data[y][x] > 12.0){
found = true;
break;
}
fk++;
}
fk=-1;
if(!found){
while((pointMiddle[0]-normX) - (pointMiddle[0] + PvectorXone*fk) > 0 ){
x = pointMiddle[0] + PvectorXone*fk;
y = pointMiddle[1] + PvectorYone*fk;
if(x >=0 && y >=0){
if(data[y][x] > 12.0){
found = true;
break;
}
}else{
break;
}
fk--;
}
}
}
for (
unsigned int k=0;k<ct.
length;k++){
}
for (
unsigned int k=0;k<ct_copy.
length;k++){
}
float col[3];
col[0] = 255;
col[1] = 255;
col[2] = 255;
for (
unsigned int k=0;k<ct_copy.
length-1;k++){
col,
1.0);
}
}