function thresholding
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include<iostream>
#include<math.h>
using namespace std;
using namespace cv;
float sig(float x)
{
float s;
if(x==0) { s=0;}
else if(x>0) {s=1;}
else(x<0) {s=-1;}
return s;
}
void threshold(Mat src,float T)
{
Mat dst;
for(int x=0;x<src.rows;x++)
{
for(int y=0;y<src.cols;y++)
{
float a=src.at<float>(x,y);
float b=dst.at<float>(x,y);
if(a>T)
{
b=sig(a)*(fabs(a)-T);
}
else
{
b=0;
}
return b;
}
}
}
int main()
{
system("clear");
Mat src=imread("/home/jamal/Bureau/lena.jpg",0);
Mat dst;
float T=1;
threshold(src,T);
namedWindow("Picture", CV_WINDOW_AUTOSIZE);
imshow("Picture", src);
namedWindow("picf", CV_WINDOW_AUTOSIZE);
imshow("Picf", dst);
waitKey();
return 0;
}
I can't compile this code.what is the error I have committed?
http://docs.opencv.org/master/db/d8e/...
@sturkmen I work with a soft thresholding function