Please note that as of October 24, 2014, we will be archiving some of the Nokia Developer discussion boards. The Nokia Asha and Nokia X sections will remain open for continued use. The "Windows Phone/Lumia" and "Other Platforms" sections will become read-only. For your Windows Phone development questions, we invite you to visit the Microsoft Developer Network (MSDN) discussion forums.

If this is your first visit, be sure to check out the FAQ. To start viewing messages, select the forum that you want to visit from the selection below.

Image processing - Sobel filter problem (edge detection)

Hi everyone,

I'm trying to perform edge detection on a bitmap I get from the camera viewfinder, using a simple sobel operator. It's quite a straight forward task, but somehow the result doesn't look like expected (something like this for the x/y gradients: http://www.dca.fee.unicamp.br/dipcou...-sobel-x-y.gif )

As you can see here, the edges are detected, but where does all the white noise come from? Shouldn't it be just plain gray? (the test image is a white triangle on a light gray background, the screenshot is from the horizontal gradient)http://tinypic.com/r/dpg1gh/3
Original image:http://tinypic.com/r/11r7h37/3

Re: Image processing - Sobel filter problem (edge detection)

Yep, you should get something like first image. Sobel doesn't do smoothing, you should get a lot of noise. You can pass through smoothing filter before edge detection filter. And don't forget fix error in dy - your code is not a sobel now.

Re: Image processing - Sobel filter problem (edge detection)

Okay, problem solved!
dx caused some problems when trying trying to convert it into a TUint8 (I expected it to work without explicitly specifying anything - but it didn't)
I use TUint8 (Abs(dx)) now and (TUint8) (Abs(dx) + Abs(dy)) for the gradient magnitude. Looks normal now, as expected.