I have a question related to unit test of some image processing algorithms. Take image rotation as an example, in order to perform image rotation, usually we need two parameters: one is the rotation angle and the other is the re-sampling method, and the function that perform image rotation then have the following signature:
void rotate_image(const Image &image, const double rotationAngle, const int rotationMethod, Image &rotatedImage);
Then, how can we design a good unit test framework to test this function? For the time being, the only solution I can figure out is: first obtain the ground truth image (that is, the rotated image with denoted rotation angle and re-sampling method) by using other state-of-art software packages (for example, MATLAB Image Processing Toolbox); after that the rotated image using the implemented function is obtained; finally, the compare the two images. If the absolute sum of the difference image is less than a threshold, then the function passes the unit test. I was wondering whether there are other solutions available to tackle this problem. Thanks.
Some test cases come into my mind:
Obviously you will have small precision errors in all cases, you have to define a tolerance.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.