LH Computer Vision and Imaging - Lab 4
info
The lab sheet and files can be downloaded here
Introduction 介紹
In this lab exercise, you will look at image registration using hand-picked selected features and the MATLAB built-in affine transform function. You will need the MATLAB Image Processing Toolbox, which is free for all students. 在本實驗練習中,您將了解如何使用手動選擇的特徵和 MATLAB 內置的仿射變換函數進行圖像註冊。 您需要 MATLAB 圖像處理工具箱,所有學生都可以免費使用。
You are asked to write a short (no more than 2 pages) report of your work, answering specific questions, and showing example images. This work is not assessed (it will not count towards your module mark) but you will get formative feedback. 您需要撰寫一份短報告(不超過 2 頁),回答特定問題並顯示示例圖像。 這項工作不會被評估(不會計入您的模塊成績),但您將獲得有益的反饋。
STEP 1
- Download the zip file and extract the data files (.tif) for Lab from CANVAS and save them in your working directory 從 CANVAS 下載 zip 文件並提取實驗室的數據文件 (.tif),並將它們保存在您的工作目錄中
- Register two images representing two different views of a fish embryo: 註冊代表魚胚胎兩個不同視圖的兩個圖像:
- the base image fish-vis.tif (transmission image, visible light) 基本圖像 fish-vis.tif(透射圖像,可見光)
- the floating image fish-cfp-#.tif that is to be registered to the base image (this is a grey-level version of a fluorescence image with Cyan Fluorescent Protein - CFP). 浮動圖像 fish-cfp-#.tif 將被註冊到基本圖像(這是一個藍綠蛋白(CFP)的荧光圖像的灰階版本)。
- [NB: # corresponds to a number; Use any or as many as you like]. [NB:# 對應於一個數字; 使用任何或您喜歡的任意數量]。
TASK 1
- Follow the tutorial on Image Registration in the Matlab Image Processing Toolbox (search for "Control point registration" in the Matlab Help). 遵循 Matlab 圖像處理工具箱中的圖像註冊教程(在 Matlab Help 中搜索"控制點註冊")。
- Use the Matlab Control Point Selection Tool cpselect() to manually select matching points in the two images from Step 1 above. 使用 Matlab 控制點選擇工具 cpselect() 手動選擇上述步驟 1 中兩個圖像中的匹配點。
- Register the two images using the selected control points 使用選定的控制點配準兩個圖像
- Display the two images. 顯示兩個圖像。
Question 1
- What is the effect of increasing/decreasing the number of chosen control points in registration accuracy? 在註冊準確性方面,增加/減少選定的控制點數量會有什麼影響?
Question 2
- How would you evaluate the accuracy of your registration? 您如何評估註冊的準確性?
Question 3
- Other than Affine, what are the other options and which one do you think works best? 除了仿射變換之外,還有哪些其他選項,您認為哪一個最適合?
General Guide
The whole process involves the following steps: 整個過程涉及以下步驟:
- Read the base image fish-vis.tif and the floating image fish-cfp-#.tif 讀取基礎圖像 fish-vis.tif 和浮動圖像 fish-cfp-#.tif
- Extract the second 'slice' from the fish-cfp-#.tif image [i.e. (:,:,2) ]. From now on use only this grey-scale image as your floating image. 從 fish-cfp-#.tif 圖像中提取第二個"切片" [即 (:,:,2) ]。 從現在開始,只使用這個灰度圖像作為您的浮動圖像。
- Use function cpselect () to select and save control points. 使用函數 cpselect () 選擇和保存控制點。
- Determine the parameters of transformation using fitgeotrans() [use 'affine' option]. 使用 fitgeotrans() 確定轉換的參數 [使用"仿射"選項]。
- Transform the input image using imwarp() 使用 imwarp() 變換輸入圖像
- this will compute your registered image (see hints and tips below). 這將計算您的註冊圖像(請參閱下面的提示和技巧)。
- Display the registered image alongside the base image. 顯示註冊圖像與基本圖像。
Hints and Tips 提示和技巧
- Before registration extract a single image plane from you colour image fish-cfp-?? ( e.g. (:,:,2)). 在註冊之前從彩色圖像 fish-cfp-?? 中提取單個圖像平面(例如 (:,:,2))。
- To ensure that the transformed image after registration is the same size as the base image, use the following form of imwarp(): 確保註冊後變換的圖像與基本圖像的大小相同,請使用以下形式的 imwarp():
registered_image = imwarp(floating_image, tform, 'FillValues', 0, 'OutputView', imref2d(size(base_image)));
- To get a semi-transparent overlay (for fun), directly after displaying the registered_image, set transparency parameter (alpha) for the base image using the following code: 要獲得半透明的重疊(出於好奇),在顯示 registered_image 之後,使用以下代碼為基本圖像設置透明度參數(alpha):
alpha=0.6;
hold on
h = imshow(base_image, gray(256));
set(h, 'AlphaData', alpha);