540 likes | 680 Views
Introduction to Computer Vision Lecture 7. Dr. Roger S. Gaborski. In conjunction with IEEE Engineering in Medicine and Biology Society in Rochester Imaging in Drug Discovery and Development Raymond Gibson Senior Investigator Merck, Sharp and Dohme Research Laboratories
E N D
Introduction to Computer VisionLecture 7 Dr. Roger S. Gaborski
In conjunction with IEEE Engineering in Medicine and Biology Society in Rochester Imaging in Drug Discovery and Development Raymond Gibson Senior Investigator Merck, Sharp and Dohme Research Laboratories 4pm, Wednesday, Sept. 26, 2007 Auditorium of the Center for Imaging Science Building 76, RIT Positron emission tomography (PET) is a non-invasive imaging technique that provides means to obtain information on drug effects and/or behavior during development (i.e. radiotracer delivery, occupancy etc). Once the occupancy/kinetics of the successful first generation drug have been characterized via imaging, imaging can be used to demonstrate that a second generation drug exhibits occupancy and kinetics which are similar to or better than the primary drug. The presentation will focus primarily on the uses of PET in drug research and development in both small (rodent) and large animal (non-human primate) models and examine some of the principal issues that PET is being used to address in terms of developing novel drugs. Roger S. Gaborski
Quiz on Thursday • Covers all material through Lecture 7 • The quiz is ‘closed book’ except you may create one page of notes to use during the quiz • You must create your own notes • Cannot copy from someone else or off web • Cannot copy lecture notes Roger S. Gaborski
Edge Detection is Not Simple Roger S. Gaborski
The derivative operation can be used to detect edgesHow can the derivative operator be approximated in a digital image?? Roger S. Gaborski
RECALL: First Derivative Approximation • First Derivative in x direction: fx (x,y) = f(x,y) – f(x-1,y) Eq 1 = f(x+1,y) – f(x,y) Eq 2 • First Derivative in y direction: fy(x,y) = f(x,y) – f(x, y-1) Eq3 = f(x, y+1) = f(x,y) Eq4 Roger S. Gaborski
First Derivative Approximation Roger S. Gaborski
First Derivative Approximation EQ1 EQ2 Roger S. Gaborski
First Derivative Approximation Eq4 Eq3 Roger S. Gaborski
Profile of Edge - Analysis • Assume gray level input range [0,1] • Edge is located at ‘peak’ of first derivative • Cannot choose only one threshold value because range of first derivative depends on slope of gray level values • The edge is located where the second derivative goes through zero-independent of slope of gray level signal Roger S. Gaborski
Profiles of an Ideal Edge Roger S. Gaborski
MATLAB Examples • Approximation to derivative – difference of adjacent data values • data = [ .10 .14 .13 .12 .11 .10 .11 .34 .33 .32 .35 .10 .11 .12 .12 .12]; • diff operator: second- first data value (.14-.10) • diff(data) = 0.04 -0.01 -0.01 -0.01 -0.01 0.01 0.23 -0.01 -0.01 0.03 -0.25 0.01 0.01 0 0 diff operator is approximation to first derivative Roger S. Gaborski
Estimate of Second Derivative • diff(diff( data)) • -0.05 0 0.0 0 0.02 0.22 -0.24 0 0.04 -0.28 0.26 0 -0.0100 0 Sign change (goes through zero) Roger S. Gaborski
Simulated Data data diff(data) diff(diff(data)) Roger S. Gaborski
How would you implement in a filter?Simple Example: • diff: second value – first value [ -1 +1 ] (could also use [+1 -1]) Roger S. Gaborski
Actual Image Data Roger S. Gaborski
Row 80 Roger S. Gaborski
diff Operator Roger S. Gaborski
Smooth Image First Roger S. Gaborski
Simple First Derivative Approximation with Smoothing Difference x = Smoothing Roger S. Gaborski
Rotate Filter Sensitive to edges at different orientations Roger S. Gaborski
Sobel Filter • Consider unequal weights for smoothing operation x = Roger S. Gaborski
Sobel Filter • Consider unequal weights for smoothing operation x = Roger S. Gaborski
Line and Edge DetectionMATLAB Functions • Line vs. Edge • imfilter • corr • conv • conv2 • edge Roger S. Gaborski
Simulated Edge Image >> i=zeros(300); >> i(149:151,:)=.5; >> i(:,149:151)=.5; >> figure, imshow(i) >> figure, plot(i(100,:)) >> axis([ 1 300 -1 1]) Roger S. Gaborski
Lines w1 = 1 1 1 0 0 0 -1 -1 -1 >> i1corr = imfilter(double(i),w1,'corr'); • imfilter • Correlation • Same size result Roger S. Gaborski
Lines w2 = 1 0 -1 1 0 -1 1 0 -1 >> i2corr = imfilter(double(i),w2,'corr'); • imfilter • Correlation • Same size result Roger S. Gaborski
Lines w1 = 1 1 1 0 0 0 -1 -1 -1 >> i2conv = imfilter(double(i),w1,'conv'); • imfilter • Convolution • Same size result Roger S. Gaborski
Lines w2 = 1 0 -1 1 0 -1 1 0 -1 >> i2conv = imfilter(double(i),w2,'conv'); • imfilter • Convolution • Same size result Roger S. Gaborski
conv2 Function >> w1=[1 1 1;0 0 0; -1 -1 -1] w1 = 1 1 1 0 0 0 -1 -1 -1 >> i1 = conv2(double(i),w1); >> figure, imshow(i1, [ ]) >> max(i1(:)) ans = 1.5000 (image values are 0 and .5 Convolution operation 1x.5+1x.5+1x.5 = 1.5 Other operations are 0) Roger S. Gaborski
conv2 Function >> w2=[1 1 1;0 0 0; -1 -1 -1]' w2 = 1 0 -1 1 0 -1 1 0 -1 >> i2 = conv2(double(i),w2); >> figure, imshow(i2, [ ]) Roger S. Gaborski
Profile of i2 >> figure, plot(i2(100,:)) >> axis([ 1 300 -2 2]) Roger S. Gaborski
Edge >> j = zeros(300); >> j(:,150:end)=.5; >> figure, imshow(j) 0 .5 Roger S. Gaborski
Correlation >> w1 w1 = 1 1 1 0 0 0 -1 -1 -1 >> i1corr = imfilter(double(j),w1,'corr'); >> figure, imshow(i1corr,[ ]) Roger S. Gaborski
Correlation >> w2 w2 = 1 0 -1 1 0 -1 1 0 -1 >> i2corr = imfilter(double(j),w2,'corr'); -1.5 Roger S. Gaborski
Convolution >> w2 w2 = 1 0 -1 1 0 -1 1 0 -1 >> i2conv = imfilter(double(j),w2,'conv'); >> figure, imshow(i2conv,[ ]) 1.5 Roger S. Gaborski
>> imP1=imread('Pineapple1.jpg'); >> figure, imshow(imP1) >> %Convert to Gray scale >> imP1gray = rgb2gray(imP1); >> figure, imshow(imP1gray) >>%Minimum and Maximum code values >> MAXcode = max(imP1gray(:)) MAXcode = 214 >> MINcode = min(imP1gray(:)) MINcode = 1 >>%Histogram Roger S. Gaborski
Edges >> imP1=imread('Pineapple1.jpg'); >> figure, imshow(imP1) >> %Convert to Gray scale >> imP1gray = rgb2gray(imP1); >> figure, imshow(imP1gray) >> imP1grayNor = mat2gray(imP1gray, [ 0 255]); >> figure, hist(imP1grayNor(:)) Roger S. Gaborski
Edges >> imP1=imread('Pineapple1.jpg'); >> figure, imshow(imP1) >> %Convert to Gray scale >> imP1gray = rgb2gray(imP1); >> figure, imshow(imP1gray) >> imP1grayNor = mat2gray(imP1gray, [ 0 255]); >> figure, hist(imP1grayNor(:)) >> >> w=[1 1 1;0 0 0; -1 -1 -1] w = 1 1 1 0 0 0 -1 -1 -1 >> imP1edge = conv2(double(imP1grayNor),w); >> figure, imshow(imP1edge, [ ]) Roger S. Gaborski
>> figure, imshow(imP1edge,[ ]) >>figure, imshow(abs(imP1edge),[ ]) Roger S. Gaborski
Edge Histogram Edge histogram Absolute Edge Histogram Roger S. Gaborski
Edge Image Thresholds >> figure, imshow(abs(imP1edge)>1.0),title('Threshold 1.0') Roger S. Gaborski
>> w=[1 1 1;0 0 0; -1 -1 -1]' w = 1 0 -1 1 0 -1 1 0 -1 >> imP1edge2 = conv2(double(imP1gray),w); >> figure, imshow(imP1edge2,[ ]) >> figure, imshow(abs(imP1edge2,[ ])) Roger S. Gaborski
>> w=[1 1 1;0 0 0; -1 -1 -1] w = 1 1 1 0 0 0 -1 -1 -1 >> w=[1 1 1;0 0 0; -1 -1 -1]' w = 1 0 -1 1 0 -1 1 0 -1 Roger S. Gaborski
MATLAB edge Function EDGE Find edges in intensity image. EDGE takes an intensity or a binary image I as its input, and returns a binary image BW of the same size as I, with 1's where the function finds edges in I and 0's elsewhere. EDGE supports six different edge-finding methods: The Sobel method finds edges using the Sobel approximation to the derivative. The Prewitt method finds edges using the Prewitt approximation to the derivative. The Roberts method finds edges using the Roberts approximation to the derivative. The Laplacian of Gaussian method finds edges by looking for zero crossings after filtering I with a Laplacian of Gaussian filter. The zero-cross method finds edges by looking for zero crossings after filtering I with a filter you specify. The Canny method finds edges by looking for local maxima of the gradient of I. The gradient is calculated using the derivative of a Gaussian filter. The method uses two thresholds, to detect strong and weak edges, and includes the weak edges in the output only if they are connected to strong edges. This method is therefore less likely than the others to be "fooled" by noise, and more likely to detect true weak edges. Roger S. Gaborski
[BW,thresh,gv,gh] = edge(imP1grayNor,'prewitt'); >> [BW,thresh,gv,gh] = Edge(imP1grayNor,'prewitt'); >> figure, imshow(gv, [ ]), title(‘gv’) >> figure, imshow(gh, [ ]), title(‘gh’) >> figure, imshow(BW) >> thresh thresh = 0.0675 Roger S. Gaborski
[BW,thresh,gv,gh] = edge(imP1grayNor,'sobel'); >> [BW,thresh,gv,gh] = edge(imP1grayNor,'sobel'); >> figure, imshow(gv,[ ]),title('gv') >> figure, imshow(gh,[ ]),title('gh') >> figure, imshow(BW),title('BW') >> thresh thresh = 0.0695 Roger S. Gaborski