| 93 | | IplImage *sobel_im; |
| 94 | | |
| 95 | | hsv = cvCreateImage(cvSize(input->width, input->height), IPL_DEPTH_8U, 3); |
| 96 | | v = cvCreateImage(cvSize(input->width, input->height), IPL_DEPTH_8U, 1); |
| 97 | | sobel = cvCreateMat(input->height, input->width, CV_32FC1); |
| 98 | | sobel_im = cvCreateImage(cvSize(input->width, input->height), IPL_DEPTH_8U, 1); |
| 99 | | output = cvCreateImage(cvSize(input->width, input->height), IPL_DEPTH_8U, 3); |
| 100 | | |
| 101 | | cvCvtColor(input, hsv, CV_BGR2HSV); |
| 102 | | cvSplit(hsv, NULL, NULL, v, NULL); |
| 103 | | cvSobel(v, sobel, 1, 1, sobel_aperture); |
| 104 | | cvConvertScale(sobel, sobel_im, 8.0, 0); |
| 105 | | cvCvtColor(sobel_im, output, CV_GRAY2BGR); |
| | 100 | IplImage *texture; |
| | 101 | |
| | 102 | hsv_full = cvCreateImage(cvSize(input->width, input->height), IPL_DEPTH_8U, 3); |
| | 103 | hsv = cvCreateImage(cvSize(working_width, working_height), IPL_DEPTH_8U, 3); |
| | 104 | v_full = cvCreateImage(cvSize(input->width, input->height), IPL_DEPTH_8U, 1); |
| | 105 | sobel_full = cvCreateMat(input->height, input->width, CV_32FC1); |
| | 106 | sobel = cvCreateMat(working_height, working_width, CV_32FC1); |
| | 107 | texture = cvCreateImage(cvSize(working_width, working_height), IPL_DEPTH_8U, 1); |
| | 108 | output = cvCreateImage(cvSize(working_width, working_height), IPL_DEPTH_8U, 3); |
| | 109 | |
| | 110 | // Colorspace conversion and scaling |
| | 111 | cvCvtColor(input, hsv_full, CV_BGR2HSV); |
| | 112 | cvSplit(hsv_full, NULL, NULL, v_full, NULL); |
| | 113 | cvResize(hsv_full, hsv, CV_INTER_AREA); |
| | 114 | |
| | 115 | // Calculate "texture" channel |
| | 116 | cvSobel(v_full, sobel_full, 1, 1, sobel_aperture); |
| | 117 | cvResize(sobel_full, sobel, CV_INTER_AREA); |
| | 118 | cvConvertScale(sobel, texture, 8.0, 0); |
| | 119 | cvSmooth(texture, texture, CV_BLUR, blur_aperture, 0, 0, 0); |
| | 120 | |
| | 121 | // Create output image |
| | 122 | cvCvtColor(texture, output, CV_GRAY2BGR); |