#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0

    Help me in image processing plz


    i have written a code in matlab.... it goes like
    I=imread('path');
    c=~im2bw(i);
    [x,y]=find(c==1);
    a=median(x);
    b=median(y);
    d=plot(b,a,'r.');
    imshow(d);

    basic task is to take an image of a block with a small circle mark.... find the location of circle ([x,y] in code above)....find centre of circle (a, b in this code)....and place a red dot over there...
    plz help me doing same in c or c++ :confused: :confused:
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,905
    Rep Power
    481
    The matlab find function returns a list of non zero indexes in the array. I agree with your median functions. Having used matlab about once and that was 12 years ago I'm not sure about plot. Let's assume that plot did not set its coordinate system using the image from imread. Let's further assume that the input figure is correct. In the right environment this program is correct:
    Code:
    int printf(char*,...);
    int main() {
      return printf("%c[31m.\n%c[m",27,27)&0;
    }
    Last edited by b49P23TIvg; November 25th, 2013 at 12:39 PM.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    2
    Rep Power
    0
    plot function plots red dot at location b,a....it is different from the rows & columns of image....it plots y-axis vs x-axis.
    i have no idea of image processing in c .... so plz illustrate ur code if possible
    Last edited by zubeguri; November 25th, 2013 at 08:03 PM. Reason: mistyping
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,905
    Rep Power
    481

    illustration of my program.


    .


    output of program above
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo