Ask Your Question

barramibac's profile - activity

2017-08-09 06:56:20 -0500 received badge  Enthusiast
2017-08-08 12:28:20 -0500 commented question function thresholding

@sturkmen I work with a soft thresholding function

2017-08-08 11:42:44 -0500 asked a question 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?

2017-08-08 11:39:23 -0500 received badge  Editor (source)
2017-07-30 06:46:07 -0500 answered a question function thresholding

Hello Everybody // fonction sigmoide float sig(float x) { float s; if(x==0) { s=0;} if(x>0) { s=1;} if(x<0) { s=-1;} return s; } // fonction de seuillage doux float soft_tresholding(float d, float T=50) { float s; if (fabs(d)>T) { s= sig(d)* (fabs(d)-T):} else { s=0;} return s; } . . . . le problème que j'ai trouvé est dans la boucle (for ) pour appliquer la fonction de seuillage sur im3 , im4 , im5 ,im6

2017-07-30 06:44:33 -0500 commented question function thresholding

..........

2017-07-28 05:57:29 -0500 asked a question function thresholding

Hello everyone: I have a question, how to add the thresholding function (hard thresholdig as exemple) in the code: