I have designed a filter in the form of a horizontal 1D vector using OpenCV and C++. The vector consists of float data. The original uchar data of the grayscale image is multiplied with this float vector as a 1 dimensional window to obtain the result. However, I am not getting proper results.
When the vector elements are multiplied with the image pixel values, the exceed the range 0-255 and I think this is causing problems.
Is there any way to typecast this float data into uchar to get proper results?
I’m using Img.at<uchar> = (uchar)(floatVector) right now.
Thanks
I will suggest you to type cast after you have multiplied…so convert your
ucharimage matrix toCV_32FC1(since you say its grayscale image so channel = 1)….do the convolution of the image with your filter then type cast the values toucharfor displaying may be..