Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

creating double precision image from uint8

Solved!
Go to solution

Hello,

I'm writing an image processing program that manipulates the gradients of the image. Since negative gradients come into picture i need to convert the image to double precision type from uint8. How can I do this? I tried using mathscript and although double precision is obtained using double function i need to come out of mathscript to perform other operations like filtering.How can i transfer this double precision image outside and perform filtering with it?

0 Kudos
Message 1 of 5
(5,328 Views)

Hello,

 

as far as I know, IMAQ uses only float type precison and not double. Isn't float type enough? Why do you need double?

 

If you really want double, then get the image as an array and cast it to double type. But then, I assume that you cannot use the native IMAQ functions (I guess it would auto cast to float datatype, before processing) and you would have to write your own function operating on an array. If you are calculating gradients, this should not be difficult. Just use an appropriate kernel and slide it across the array -> convolution.

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 2 of 5
(5,318 Views)

hello klemen,

Yes i had tried float type casting and did get the data type compatabiliy issue for filtering operationsSmiley Sad

i'm not sure which is the best option:

1) writing filtering functions in mathscript but i'm not sure if this is possible

2) using float point casting and writing filter functions which i don't know

Could you show me a simple way  to manually perform filtering using a mask ?

0 Kudos
Message 3 of 5
(5,307 Views)
Solution
Accepted by topic author Prathiksha

Hello,

 

if you are satisfied with float datatype, why don't you just use the convolution operator?

 

For example (using a Sobel kernel, you can choose your own of course):

 

Sobel_example.png

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 4 of 5
(5,288 Views)

Thank you.....it worked...Smiley Happy

0 Kudos
Message 5 of 5
(5,270 Views)