Hello, I am currently reading images stored in the targa file format so that I can apply some kind of filters on it. For instance, I read the test image and then try to apply the mean filter on it. In this case I want to multiply the value of every pixel that will take part of the determination of the value of a certain pixel by 1/9. The problem is that when I read the image from the disk I read a bunch of char values.
And if I try to multiply a char by 1/9, I end with zero, and so with full black image.
So I decided to convert it to float to do the processing and then convert back to char in the writing time. The problem is that the char to float method is not working. For example:
1 2 3
char tmp = 100;
float teste = a1_9 * (float) (tmp);
cout << "Teste float: "<< teste << endl;
And the result is always zero which means a black image.
Am I understanding it wrongly? How should I convert the char to float to that I can calculate de average? Thanks for the attention.