TAILIEUCHUNG - OpenCVTutorial - Part III

Tham khảo tài liệu 'opencvtutorial - part iii', khoa học xã hội, thư viện thông tin phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | OpenCV Tutorial Part 3 Image Correlation Gavin S Page gsp8334@ Tasks After learning to work with images it is important to learn some of the accessory functions OpenCV has to offer. This tutorial will discuss a simple image correlation example. Steps Performed Load an Image (Explanation Skipped) Convert to Gray Extract Template Region Apply Match Functions At this point loading an image and converting it to grayscale should be a simple task and can be copied from past tutorials. Gavin S Page gsp8334@ Extract Template Region //define the starting point and size of rectangle int xVal = 1145; int yVal = 890; int neighLength = 25; CvRect rect = cvRect(xVal,yVal,neighLength,neighLength); //create the template and extract it from the source image CvMat* tplate = cvCreateMat(neighLength, neighLength, CV_8UC1); cvGetSubRect(imG, tplate, rect ); Determine the starting point and the size of the region and create the CvRect. Specify Region Use cvGetSubRect to copy the template from the region. Here the template region is specified and extracted. Gavin S Page gsp8334@ Use Template Match //specify the size needed by the match function int resultW = imG->width - tplate->width + 1; int resultH = imG->height - tplate->height +1; //create each of the result images IplImage* result0 = cvCreateImage(cvSize(resultW, resultH), IPL_DEPTH_32F, 1); IplImage* result1 = cvCreateImage(cvSize(resultW, resultH), IPL_DEPTH_32F, 1); IplImage* result2 = cvCreateImage(cvSize(resultW, resultH), IPL_DEPTH_32F, 1); IplImage* result3 = cvCreateImage(cvSize(resultW, resultH), IPL_DEPTH_32F, 1); IplImage* result4 = cvCreateImage(cvSize(resultW, resultH), IPL_DEPTH_32F, 1); IplImage* result5 = cvCreateImage(cvSize(resultW, resultH), IPL_DEPTH_32F, 1); //apply each of the matching techniques cvMatchTemplate(imG, tplate, result0, CV_TM_SQDIFF); cvMatchTemplate(imG, tplate, result1, CV_TM_SQDIFF_NORMED); cvMatchTemplate(imG, tplate, result2, CV_TM_CCORR); cvMatchTemplate(imG, tplate, result3, CV_TM_CCORR_NORMED); cvMatchTemplate(imG, tplate, result4, CV_TM_CCOEFF); cvMatchTemplate(imG, tplate, result5, CV_TM_CCOEFF_NORMED); The image targets for the result of the match function have to be of size W-w+1×H-h+1 and of type 32-bit single channel floating point. Create Result Images Apply each of the match techniques for the example. This slide documents the creation of the target images and the usage of the cvMatchTemplate function. Gavin S Page gsp8334@ Original Image and Template The original, grayscale image with template. Notice the region from which the template was extracted is labeled in the image. Gavin S Page gsp8334@ Poor Results CCOEFF CCORR SQDIFF These particular methods did not demonstrate good results. Gavin S Page gsp8334@ Good Results Notice the high values on the circular letters on the sign CCOEFF_NORMED Gavin S Page gsp8334@ Good Results Notice the high values on the circular letters on the sign CCORR_NORMED Gavin S Page gsp8334@ Good Results Notice the low values on the circular letters on the sign SQDIFF_NORMED Gavin S Page gsp8334@ Final This tutorial illustrated a simple example of image correlation. It showed that the normalized techniques exhibited better results Gavin S Page gsp8334@

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.