03-27-2014 05:13 AM
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?
Solved! Go to Solution.
03-27-2014 06:30 AM - edited 03-27-2014 06:32 AM
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
03-27-2014 08:46 AM
hello klemen,
Yes i had tried float type casting and did get the data type compatabiliy issue for filtering operations
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 ?
03-28-2014 02:02 AM - edited 03-28-2014 02:03 AM
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):
Best regards,
K
03-30-2014 11:45 PM
Thank you.....it worked...