summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-25 09:27:46 +0200
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-05-25 09:27:46 +0200
commit4b524e3026d5b1efedaf83e730d3e21cc924dc3b (patch)
treec4437452993988f249179beffd88b70a84d387c3
parent724b8953b587548cab615aacfd3c78f518f67c8f (diff)
downloadcv-4b524e3026d5b1efedaf83e730d3e21cc924dc3b.zip
cv-4b524e3026d5b1efedaf83e730d3e21cc924dc3b.tar.gz
cv-4b524e3026d5b1efedaf83e730d3e21cc924dc3b.tar.bz2
cvg: Use image depth and channels properties in blits
-rw-r--r--cvg.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/cvg.c b/cvg.c
index 82c1085..42c02f4 100644
--- a/cvg.c
+++ b/cvg.c
@@ -240,23 +240,23 @@ file_set(GtkFileChooserButton *widget, gpointer userdata)
static IplImage *
pass_through_filter(struct cvg *cvg, IplImage *image)
{
- IplImage *output;
+ IplImage *out;
- output = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3);
- cvCopy(image, output, NULL);
+ out = cvCreateImage(cvGetSize(image), image->depth, image->nChannels);
+ cvCopy(image, out, NULL);
- return output;
+ return out;
}
static IplImage *
gauss_filter(struct cvg *cvg, IplImage *image)
{
- IplImage *output;
+ IplImage *out;
- output = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3);
- cvSmooth(image, output, CV_GAUSSIAN, 9, 9, 0, 0);
+ out = cvCreateImage(cvGetSize(image), image->depth, image->nChannels);
+ cvSmooth(image, out, CV_GAUSSIAN, 9, 9, 0, 0);
- return output;
+ return out;
}
static IplImage *
@@ -268,9 +268,7 @@ good_features_to_track(struct cvg *cvg, IplImage *image)
double quality_level = 0.1, min_distance = 5;
int i, eig_block_size = 3, use_harris = 0;
- output = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 3);
- cvCopy(image, output, NULL);
-
+ output = pass_through_filter(cvg, image);
gray_frame = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
eig_image = cvCreateImage(cvGetSize(image), IPL_DEPTH_32F, 1);
temp_image = cvCreateImage(cvGetSize(image), IPL_DEPTH_32F, 1);