diff options
-rw-r--r-- | cvg.c | 24 | ||||
-rw-r--r-- | cvg.ui | 1 |
2 files changed, 25 insertions, 0 deletions
@@ -260,6 +260,28 @@ gauss_filter(struct cvg *cvg, IplImage *image) } static IplImage * +sobel_filter(struct cvg *cvg, IplImage *image) +{ + IplImage *out, *tmp, *tmp2, *gray; + + gray = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1); + tmp = cvCreateImage(cvGetSize(image), IPL_DEPTH_16S, 1); + tmp2 = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1); + out = cvCreateImage(cvGetSize(image), image->depth, image->nChannels); + + cvCvtColor(image, gray, CV_BGR2GRAY); + cvSobel(gray, tmp, 0, 1, 3); + cvConvertScaleAbs(tmp, tmp2, 1, 0); + cvCvtColor(tmp2, out, CV_GRAY2BGR); + + cvReleaseImage(&gray); + cvReleaseImage(&tmp); + cvReleaseImage(&tmp2); + + return out; +} + +static IplImage * good_features_to_track(struct cvg *cvg, IplImage *image) { IplImage *output, *gray_frame, *eig_image, *temp_image; @@ -326,6 +348,8 @@ method_set(GtkComboBox *widget, gpointer userdata) cvg->filter = good_features_to_track; else if (strcmp(text, "Pass-Through") == 0) cvg->filter = pass_through_filter; + else if (strcmp(text, "Sobel") == 0) + cvg->filter = sobel_filter; else if (strcmp(text, "Hide") == 0) cvg->filter = hide_filter; update_right_drawing_area(cvg); @@ -84,6 +84,7 @@ <item>Hide</item> <item>Gauss</item> <item>GoodFeaturesToTrack</item> + <item>Sobel</item> <item>Pass-Through</item> </items> <signal name="changed" handler="method_set" swapped="no"/> |