Ask Your Question

Jawaher Khemakhem's profile - activity

2020-04-18 07:34:29 -0600 received badge  Popular Question (source)
2019-02-01 16:43:00 -0600 received badge  Popular Question (source)
2014-12-09 13:52:45 -0600 marked best answer Extract connected pixels using the idea of Breadth-first search

I am trying to collect a set of pixels between two pixels:start and end point from a skeleton image . image description So the idea is : I start on a position in the image. I put that position in a list. Then in a loop,

  • I get and remove the point at the beginning of the list and make it black in the current image so it won't be added again.
  • I put that point in another list (this is the list that you want).I look at every point around the position and if it is not black, add it to the beginning of the list.

Then start the loop again.

I have develop a piece of code but the loop ends after adding four or five pixels ,before arriving to the end point

 vector<Point> traceLine(Mat img , Point peak)

  {

   vector<Point> vect1;
   vector<Point> vect2;
   vect1.push_back(peak);
        while(vect1.size() != 0)
          {
            Point p=vect1[0];
            img.at<uchar>(p.x,p.y)=0;
            vect1.erase(vect1.begin());
            //cout<<vect1[1];

            vect2.push_back(p);
             vector<Point> vectN;
            vectN=search8Neighbor(img,p);
            cout<<vectN.size()<<endl;
            if(vectN.size()!=0)
                  {
                   for(int i=0;i<vectN.size();i++)

                     vect1.push_back(vectN[i]);

                  }
           }
        return vect2;
 }
2014-12-09 13:52:40 -0600 marked best answer how to extract Edge lists ?

I am working on binary image .I have extracted skeleton and the only junction point in the image. image description

Now I have to extract a list of points :

-from the top-left of the image to the junction point (nearly) in the middle .

-from the junction point to the top- right point in the image .

Any idea to do it ?

2014-07-17 15:49:36 -0600 received badge  Enlightened (source)
2014-07-17 15:49:36 -0600 received badge  Good Answer (source)
2013-07-03 13:36:56 -0600 answered a question Inv function

See here the documentation please post your code so we can help you .I didn't get the problem .

2013-07-02 06:46:40 -0600 answered a question Character Slant Correction

Here some codes here and here may be it help you .

2013-07-01 07:20:50 -0600 answered a question CvBox2D cvMinAreaRect2 points ?

Have a look at the documentaion

2013-06-25 14:50:49 -0600 received badge  Nice Answer (source)
2013-06-20 12:13:22 -0600 received badge  Nice Answer (source)
2013-06-19 23:18:45 -0600 received badge  Nice Answer (source)
2013-06-03 14:22:15 -0600 commented question Error running my project

yes I try your code and everything is ok

2013-06-03 10:54:39 -0600 commented question Error running my project

May be there is a problem with the type of the image that your code reads , have a look here http://opencv.willowgarage.com/documentation/cpp/reading_and_writing_images_and_video.html#cv-imread

2013-06-03 10:51:16 -0600 commented question Error running my project

please post your code

2013-06-03 10:47:10 -0600 commented question Cat function of Matlab

I didn't understand rpad{i,:}

2013-06-02 10:43:16 -0600 received badge  Teacher (source)
2013-06-02 02:54:41 -0600 answered a question My Open CV code doesnt do anything when i execute it

May be you forget to put waitkey(0);

// display image
cv::namedWindow("Image");
cv::imshow("Image",image);
cv::waitKey(0);
return(0);
2013-06-02 02:38:19 -0600 answered a question Accessing pixel and coordinate of an image using OpenCV

Have a look here and here

2013-06-02 02:27:50 -0600 commented answer where should I put my image ?

You can create a folder "projectsOpencv " in your desktop , put the file containing your code "example.cpp" and your image "0.jpg"in the same folder "projectsOpencv" . In this case , char filename[]="0.jpg"; do not modify your code .

2013-06-01 12:38:04 -0600 answered a question where should I put my image ?

There is two methods for calling a file :

  • absolute path

C:\projects\myProject\img.png

  • non absolute path (relative path)

img.png

Do not forget to put the path between " " .

In the above example, the absolute path contains the full path to the file and not just the file as seen in the non absolute path.

For example , you can put your code source test.cpp and your image in a folder ,name it for example opencv and try the non absolute path .

2013-05-30 14:41:40 -0600 commented answer Is this line code correct?

hey , with pleasure :)

2013-05-29 15:02:04 -0600 commented question How to calculate the Affine Moment Invariants of a binary image

thanks a lot , I feel a little bit confused about Affine Moment Invariants .

2013-05-29 14:50:39 -0600 commented question How to calculate the Affine Moment Invariants of a binary image

Can we calculate it for each pixel ?

2013-05-29 14:42:53 -0600 commented question How to calculate the Affine Moment Invariants of a binary image

I have a question please , we calculate the affine moment invariant for all the image or for each pixel ?

2013-05-28 12:40:51 -0600 answered a question from MAT to BIDIMENSIONAL ARRAY

A mat object is 2 D or 3 D array , if we consider that your mat object is 2 D so it is obligatory an array with dimension 2 , you can access to each element in your object mat "im" using for example :

for (int i = 0; i < im.rows; i++)
{
    for (int j = 0; j < im.cols; j++)
    {
        uchar p1 = im.at<uchar>(i, j);// you can access to each element (row/col) 

    }
}
2013-05-28 12:30:14 -0600 answered a question Is this line code correct?

There are two possible cases of multiply for matrices .

Matrix multiplication is where two matrices are multiplied directly. This operation multiplies matrix A of size [a x b] with matrix B of size [b x c] to produce matrix C of size [a x c]. In OpenCV it is achieved using the simple * operator:

C = A * B

Element-wise multiplication is where each pixel (element) in the output matrix is formed by multiplying that pixel (element) in matrix A by its corresponding entry in matrix B. The input matrices should be the same size, and the output will be the same size as well. This is achieved using the mul() function:

output = A.mul(B);

2013-05-28 12:18:12 -0600 commented question Is this line code correct?

imfft is the name of Mat object ?

2013-05-28 04:48:02 -0600 answered a question converting from iplimage to cvmat and vise versa

To convert from Mat to IplImage :

 Mat mat_img;
IplImage ipl_img = mat_img;

For example to use ipl_img you will write ,

cvNot(&ipl_img ,&ipl_img );

To convert from IplImage to Mat :

IplImage ipl_img;
Mat mat_img(ipl_img );
2013-05-27 13:04:05 -0600 received badge  Student (source)
2013-05-27 12:33:59 -0600 asked a question How to perform changes in both sub-image and original image ?

I have limited a region of interest in a binary image with a rectangle . I have convert this rectangle to a new matrix . now whenever I perform an operation in this matrix there is no change in the original image , but what I want is to have a change in the original image .

     // region of interest 
       Rect roi(maxloc.x,maxloc.y, m2.cols,m2.rows);
    //new matrix  
       Mat image_roi = m1(roi);
    //perform operations 
       bitwise_not(image_roi,image_roi);
      image_roi=choice(image_roi);
     imshow("image",m1);//there is no change in m1
2013-05-25 08:33:58 -0600 commented answer Build graph from an image

Many thanks , I got the idea how we can build a graph from an image :)

2013-05-25 02:47:14 -0600 marked best answer Build graph from an image

I have a binary image and I am trying to build undirected graph from this image in order to apply minimum spanning tree . My idea is from this paper http://cs.brown.edu/~pff/papers/seg-ijcv.pdf

I have no idea how to build the graph .