The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   OS X Developer (http://hintsforums.macworld.com/forumdisplay.php?f=27)
-   -   finding angle of line in data (Biometrics) (http://hintsforums.macworld.com/showthread.php?t=123358)

maverick 05-18-2011 10:02 AM

Quote:

Originally Posted by bramley (Post 623390)
Sorry - but I beg to differ.

Looks like your latest routine is not picking up vertical edges. None of the detail above and to Lena's left is being picked up for example.
EDIT(Actually implies there's something wrong with your dx calculation)
Implies there's at least one problem in your code dealing with dy. Are you sure your y Sobel mask is the right way up? Cocoa uses a bottom left origin not a top left origin as in some graphic systems.

After Hayne told to make some simple image i did what he said. I made simple 4x4 image and watched every step. I did the math on my own and saw what my program will do. And then i figured out where is my problem.
And yes I think this code is correct right now. This convolution is correct. And if you copy my code to your program and you will add this 2 loops instead of Sobel algorithm:

Code:

    for(row=0; row<height/2; row++) {
        for(col=0; col<width/2; col++) {
            pixels[row*width + col] = 0;
        }
    }

you will see that the origin is in top left point of an image.

Quote:

Originally Posted by bramley (Post 623390)
Also don't see why simply copying an array improves your result. Would seem that something else is actually going on.

Well maybe i didn't write it correctly. I pick 3x3 matrix of an image (around point [x,y]) and multiply it by 3x3 sobel mask. After summing etc. i have to store somewhere this new value. I cannot write it directly at [x,y] of an image, because I will use original values in further calculations. Each pixel is being used several times during calculations. So, after all calculations, i have new matrix. I can copy calculated values to 'pixels' matrix or make a new image from this matrix.

But OK, now i see that i took wrong image ;) I should use this one:

http://img687.imageshack.us/img687/5...110518godz.png

If you have other insights please feel free to write. :) As anyone else :) And sorry for my bad english :)

hayne 05-18-2011 01:01 PM

Not sure, but isn't there an edge detection routine in the Cocoa frameworks somewhere? I know it's one of the things that QuickTime can do.

maverick 05-20-2011 03:26 AM

Well, to be honest, I haven't heard about it. But even if there is a class for edge detection, I'm glad to write my own program just to practice. I'm new in image processing and this seems to be great exercise :)


All times are GMT -5. The time now is 06:21 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.