X-Git-Url: https://git.ao2.it/experiments/opencv.git/blobdiff_plain/33b5c562ffffa24e92ffccab3bb1118c06baae18..refs/heads/master:/perspective-transform/opencv-perspective-transform.c?ds=sidebyside diff --git a/perspective-transform/opencv-perspective-transform.c b/perspective-transform/opencv-perspective-transform.c index 672795a..270f7f3 100644 --- a/perspective-transform/opencv-perspective-transform.c +++ b/perspective-transform/opencv-perspective-transform.c @@ -1,3 +1,22 @@ +/* + * opencv-perspective-transform - Example program for cvWarpPerspective() + * + * Copyright (C) 2013 Antonio Ospite + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include @@ -35,14 +54,14 @@ int main(int argc, char *argv[]) cvNamedWindow("Viewport", 0); cvResizeWindow("Viewport", WIDTH, HEIGHT); - /* Trasform only a part of the whole image */ + /* Transform only a part of the whole image */ viewport.x = 0; viewport.y = 0; viewport.width = WIDTH; viewport.height = HEIGHT; cvSetImageROI(image, viewport); - /* Calculate the prospective tranformation */ + /* Calculate the perspective transform */ src[0].x = 0; src[0].y = 0; src[1].x = WIDTH; @@ -71,11 +90,11 @@ int main(int argc, char *argv[]) perspective_matrix = cvGetPerspectiveTransform(src, dst, perspective_matrix); - /* Create a new image and apply the prospective transformation */ + /* Create a new image and apply the perspective transform */ transformed_image = cvCreateImage(cvSize(WIDTH, HEIGHT), image->depth, image->nChannels); if (!transformed_image) { - fprintf(stderr, "Cannot create trasnformed image\n"); + fprintf(stderr, "Cannot create transformed image\n"); ret = -EINVAL; goto out_release_mat; } @@ -90,6 +109,7 @@ int main(int argc, char *argv[]) ret = 0; + cvReleaseImage(&transformed_image); out_release_mat: cvReleaseMat(&perspective_matrix); out_destroy_window: