LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use the Sobel Kernel?

Hello,

I am acquiring images from a camera and I would like to find the edges in the image. So I have applied the Sobel kernel no. 16 and no. 20 on the same image separetly to receive two image with the edges in the 'x' direction and in the 'y' direction. However the values of the pixels in the resultant images are the same despite the fact that I have applied different kernels. I have connected the image and the Kernel to the IMAQ convulte vi.

The image data type is 16bit signed integer and I would like to keep it in that form.

I also could not find a way to calculate the image absolute value after I apply the kernel.

Thank in advance.

Eldad
0 Kudos
Message 1 of 4
(2,795 Views)
Hello,

Thanks for using National Instruments' Discussion Forums!

Like you mentioned, when using a Sobel Kernel you will receive two different images as a result if the kernels themselves are different. In fact, with the two you mentioned you will most likely get one image that highlights X direction edges and one image that highlights Y direction edges.

The fact that you are getting the same image leads me to believe that perhaps the same image buffer is being used for the resulting image. The image data type within LabVIEW is actually a pointer to a location in memory, and if we have only created one place to store an image, our second convolution will write the resulting image over the first resulting image.

In this case, you should be able to easily make a second buffer with a different name in Labview. Use this buffer as the destination for your operation.

Additionally, you should be able to use an Image absolute difference on the "operators" palette and subtract a constant 0 in order to take the absolute value of your image.

Hopefully this should resolve your problem. If it doesn't, let me know a little bit more about its behavior and I am sure that we can get things worked out.

Have a great day,

Robert
0 Kudos
Message 2 of 4
(2,777 Views)
Hello Robert,

Thank you for the information regarding the problem with the sobel Kernel. However with regard to the absolute value problem I think that I have not explain myself very well. After I get two seperate images I would like to find their absolute value together. I will give an example, if x=3 and y=-4 are the values of corresponding pixels in the seperate images, then I would like to construct two other images that will have the value 5 for the absolute value and -53.13 for the angle.

The only way i thought of doing it was inside a loop where I use the getpixelvalue.vi and setpixelvalue.vi?


Could you help me?

Eldad
0 Kudos
Message 3 of 4
(2,765 Views)
Hi Eldad,

Unfortunately I don't believe I have a clear understanding of what you mean by absolute value. At first, I had thought you meant that you wanted ot make sure there were no negative values in your image. Next, I thought you meant that you needed to take two seperate images and make it into one image containing information from both images.

Now however, it seems that you are referring to using some sort of vector or something. I guess I am not clear on what x=3 and y=-4 represent.

Sorry, but hopefully with more information we can figure this one out as well!

Robert
0 Kudos
Message 4 of 4
(2,748 Views)