Skip to content

Commit 1abe249

Browse files
committed
Silence non-functional warnings in tests. Comment out deprecated vision.LocalMaximaFinder and point to errata.
1 parent 6cb7211 commit 1abe249

8 files changed

Lines changed: 96 additions & 50 deletions

File tree

book/code/appendices.mlx

91 Bytes
Binary file not shown.

book/code/chapter11.mlx

-124 Bytes
Binary file not shown.

book/code_m/appendices.m

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
%[text] %[text:anchor:F4CCA683] # Robotics, Vision & Control 3e: for MATLAB
22
%[text] %[text:anchor:874DADDE] # Appendices
33
%[text:tableOfContents]{"heading":"Table of Contents"}
4-
%[text] %[text:anchor:H_FD45E4DF] Copyright 2022\-2023 Peter Corke, Witold Jachimczyk, Remo Pillat
4+
%[text] %[text:anchor:H_FD45E4DF] Copyright 2022-2023 Peter Corke, Witold Jachimczyk, Remo Pillat
55
%[text] %[text:anchor:F954A5D5] ## Appendix C: Geometry
66
%[text] %[text:anchor:BAEBF2AC] ### C.1 Euclidean Geometry
7-
%[text] %[text:anchor:E4239FA6] #### C.1\.2 Lines
8-
%[text] %[text:anchor:E7791A79] #### C.1\.2\.2 Lines in 3D and Plücker Coordinates
7+
%[text] %[text:anchor:E4239FA6] #### C.1.2 Lines
8+
%[text] %[text:anchor:E7791A79] #### C.1.2.2 Lines in 3D and Plücker Coordinates
99
P = [2 3 4]; Q = [3 5 7];
1010
L = Plucker(P,Q)
1111
L.v
@@ -17,7 +17,7 @@
1717
[x,d] = L.closest([1 2 3]) %#ok<*ASGLU>
1818
L.intersect_plane([0 0 1 0])
1919
%%
20-
%[text] %[text:anchor:B107E972] #### C.1\.4 Ellipses and Ellipsoids
20+
%[text] %[text:anchor:B107E972] #### C.1.4 Ellipses and Ellipsoids
2121
E = [1 1;1 2];
2222
clf; plotellipse(E); hold on
2323
[x,e] = eig(E)
@@ -26,15 +26,15 @@
2626
p = x(:,2)*r(2); quiver(0,0,p(1),p(2),0,"r");
2727
atan2d(x(2,1),x(1,1))
2828
%%
29-
%[text] %[text:anchor:81891655] #### C.1\.4\.1 Drawing an Ellipse
29+
%[text] %[text:anchor:81891655] #### C.1.4.1 Drawing an Ellipse
3030
E = [1 1; 1 2];
3131
th = linspace(0,2*pi,50);
3232
y = [cos(th);sin(th)];
3333
x = inv(sqrtm(E))*y;
3434
clf; plot(x(1,:),x(2,:));
3535
clf; plotellipse(E)
3636
%%
37-
%[text] %[text:anchor:A199F180] #### C.1\.4\.2 Fitting an Ellipse to Data
37+
%[text] %[text:anchor:A199F180] #### C.1.4.2 Fitting an Ellipse to Data
3838
rng(0); % reset random number generator
3939
x = []; % empty point set
4040
while size(x,2) < 500
@@ -61,8 +61,8 @@
6161
plotellipse(E_est,"r")
6262
%%
6363
%[text] %[text:anchor:22C91717] ### C.2 Homogeneous Coordinates
64-
%[text] %[text:anchor:A2EF233A] #### C.2\.1 Two Dimensions
65-
%[text] %[text:anchor:25F2AFB3] #### C.2\.1\.1 Points and Lines
64+
%[text] %[text:anchor:A2EF233A] #### C.2.1 Two Dimensions
65+
%[text] %[text:anchor:25F2AFB3] #### C.2.1.1 Points and Lines
6666
l1 = [1 -1 0];
6767
l2 = [1 -1 -1];
6868
plothomline(l1,"b")
@@ -103,7 +103,7 @@
103103
s = chi2inv(0.5,2)
104104
%%
105105
%[text] %[text:anchor:DD77BE42] ## Appendix H: Kalman Filter
106-
%[text] %[text:anchor:72ADDA8C] ### H.2 Nonlinear Systems \-\- Extended Kalman Filter
106+
%[text] %[text:anchor:72ADDA8C] ### H.2 Nonlinear Systems -- Extended Kalman Filter
107107
x = 2*randn(1000000,1) + 5;
108108
y = (x+2).^2/4;
109109
clf; histogram(y, Normalization="pdf");
@@ -150,16 +150,19 @@
150150
z
151151
[zmax,i] = max(z(:))
152152
[y,x] = ind2sub(size(z),i)
153-
LMaxFinder = vision.LocalMaximaFinder(MaximumNumLocalMaxima=3, ...
154-
NeighborhoodSize=[3 3],Threshold=0);
155-
LMaxFinder(z)
153+
154+
%% vision.LocalMaximaFinder has been deprecated. See errata: https://github.com/petercorke/RVC3-MATLAB/wiki/Errata
155+
156+
% LMaxFinder = vision.LocalMaximaFinder(MaximumNumLocalMaxima=3, ...
157+
% NeighborhoodSize=[3 3],Threshold=0);
158+
% LMaxFinder(z)
156159
%[text]
157160
%[text] Suppress syntax warnings in this file
158161
%#ok<*NASGU>
159162
%#ok<*AGROW>
160163
%#ok<*MINV>
161164

162-
%[appendix]
165+
%[appendix]{"version":"1.0"}
163166
%---
164167
%[metadata:view]
165168
% data: {"layout":"inline","rightPanelPercent":40}

book/code_m/chapter11.m

Lines changed: 40 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
%[text] %[text:anchor:F4CCA683] # Robotics, Vision & Control 3e: for MATLAB
22
%[text] %[text:anchor:CAAB408D] # Chapter 11: Images and Image Processing
3-
%[text:tableOfContents]{"heading":"**Table of Contents**"}
3+
%[text:tableOfContents]{"heading":"Table of Contents"}
44
%[text] %[text:anchor:DD428C66] #
5-
%[text] Copyright 2022\-2023 Peter Corke, Witold Jachimczyk, Remo Pillat
6-
%[text] %[text:anchor:C44A23DD] ## 11\.1 Obtaining an Image
7-
%[text] %[text:anchor:5AD1F85D] ### 11\.1\.1 Images from Files
5+
%[text] Copyright 2022-2023 Peter Corke, Witold Jachimczyk, Remo Pillat
6+
%[text] %[text:anchor:C44A23DD] ## 11.1 Obtaining an Image
7+
%[text] %[text:anchor:5AD1F85D] ### 11.1.1 Images from Files
88
street = imread("street.png");
99

1010
whos street
@@ -39,7 +39,7 @@
3939
md = imfinfo("roof.jpg")
4040

4141
md.DigitalCamera
42-
%[text] %[text:anchor:8EAC253F] ### 11\.1\.2 Images from an Attached Camera
42+
%[text] %[text:anchor:8EAC253F] ### 11.1.2 Images from an Attached Camera
4343
% Not runnable section.
4444
% The following code only works if you have a webcam attached to your
4545
% computer. Uncomment if you want to run it.
@@ -53,7 +53,7 @@
5353
%im = cam.snapshot;
5454

5555
%cam.preview
56-
%[text] %[text:anchor:13D2568B] ### 11\.1\.3 Images from a Video File
56+
%[text] %[text:anchor:13D2568B] ### 11.1.3 Images from a Video File
5757
vid = VideoReader("traffic_sequence.mpg");
5858

5959
vid.NumFrames
@@ -71,13 +71,13 @@
7171
cont = vid.hasFrame && videoPlayer.isOpen;
7272
pause(0.05);
7373
end
74-
%[text] %[text:anchor:54CABEB2] ### 11\.1\.4 Images from the Web
74+
%[text] %[text:anchor:54CABEB2] ### 11.1.4 Images from the Web
7575
img = imread("http://uk.jokkmokk.jp/photo/nr4/latest.jpg");
7676

7777
size(img)
7878

7979
imshow(img)
80-
%[text] %[text:anchor:5B5701F4] ### 11\.1\.5 Images from Code
80+
%[text] %[text:anchor:5B5701F4] ### 11.1.5 Images from Code
8181
im = testpattern("rampx",256,2);
8282
im = testpattern("siny",256,2);
8383
im = testpattern("squares",256,50,25);
@@ -98,7 +98,7 @@
9898

9999
imshow(canvas)
100100
%%
101-
%[text] %[text:anchor:61BDB3A2] ## 11\.2 Image Histograms
101+
%[text] %[text:anchor:61BDB3A2] ## 11.2 Image Histograms
102102
church = rgb2gray(imread("church.png"));
103103
imhist(church)
104104

@@ -110,7 +110,7 @@
110110
[~,p] = findpeaks(counts,x,MinPeakDistance=60);
111111
p' % transpose for display
112112
%%
113-
%[text] %[text:anchor:9736A4AD] ## 11\.3 Monadic Operations
113+
%[text] %[text:anchor:9736A4AD] ## 11.3 Monadic Operations
114114
imd = im2double(church);
115115

116116
im = im2uint8(imd);
@@ -138,7 +138,7 @@
138138

139139
imshow(church/64,[])
140140
%%
141-
%[text] %[text:anchor:38013E66] ## 11\.4 Dyadic Operations
141+
%[text] %[text:anchor:38013E66] ## 11.4 Dyadic Operations
142142
subject = im2double(imread("greenscreen.jpg"));
143143
imshow(subject)
144144

@@ -159,7 +159,7 @@
159159
imshow(bg.*(1-mask))
160160

161161
imshow(subject.*mask + bg.*(1-mask))
162-
%[text] %[text:anchor:EDFF06F1] ### 11\.4\.1 Application: Motion detection
162+
%[text] %[text:anchor:EDFF06F1] ### 11.4.1 Application: Motion detection
163163
vid = VideoReader("traffic_sequence.mpg");
164164

165165
bg = im2double(im2gray(vid.readFrame()));
@@ -173,11 +173,11 @@
173173
imshow(bg);
174174
end
175175
%%
176-
%[text] %[text:anchor:AE329B49] ## 11\.5 Spatial Operations
177-
%[text] %[text:anchor:1A46459C] ### 11\.5\.1 Linear Spatial Filtering
176+
%[text] %[text:anchor:AE329B49] ## 11.5 Spatial Operations
177+
%[text] %[text:anchor:1A46459C] ### 11.5.1 Linear Spatial Filtering
178178
%Y = imfilter(X,K,"conv");
179179

180-
%[text] %[text:anchor:348E58ED] #### 11\.5\.1\.1 Image Smoothing
180+
%[text] %[text:anchor:348E58ED] #### 11.5.1.1 Image Smoothing
181181

182182
K = ones(21,21) / 21^2;
183183

@@ -196,7 +196,7 @@
196196
K = fspecial("disk",8);
197197

198198
%[text]
199-
%[text] %[text:anchor:855F2550] #### 11\.5\.1\.3 Edge Detection
199+
%[text] %[text:anchor:855F2550] #### 11.5.1.3 Edge Detection
200200

201201
castle = im2double(imread("castle.png"));
202202

@@ -241,7 +241,7 @@
241241
plot(570:600,p,"-o");
242242

243243
bw = edge(castle,"log");
244-
%[text] %[text:anchor:3FAEB9E9] ### 11\.5\.2 Template Matching
244+
%[text] %[text:anchor:3FAEB9E9] ### 11.5.2 Template Matching
245245
mona = im2double(rgb2gray(imread("monalisa.png")));
246246
A = mona(170:220,245:295);
247247

@@ -285,16 +285,19 @@
285285

286286
imshow(S,[]), colorbar
287287

288-
peakFinder = vision.LocalMaximaFinder(MaximumNumLocalMaxima=5, ...
289-
NeighborhoodSize=[3 3],Threshold=min(S(:)));
290-
uvLoc = peakFinder.step(S);
291-
vals = S(sub2ind(size(S),uvLoc(:,2),uvLoc(:,1)))'
292288

293-
labels = "Wally " + string(1:5) + ": " + string(vals);
294-
markedSim = insertObjectAnnotation(S,"circle",[uvLoc, ...
295-
10*ones(5,1)],labels,FontSize=21);
296-
imshow(markedSim)
297-
%[text] %[text:anchor:5981651E] ### 11\.5\.3 Nonlinear Operations
289+
%% vision.LocalMaximaFinder has been deprecated. See errata: https://github.com/petercorke/RVC3-MATLAB/wiki/Errata
290+
291+
% peakFinder = vision.LocalMaximaFinder(MaximumNumLocalMaxima=5, ...
292+
% NeighborhoodSize=[3 3],Threshold=min(S(:)));
293+
% uvLoc = peakFinder.step(S);
294+
% vals = S(sub2ind(size(S),uvLoc(:,2),uvLoc(:,1)))'
295+
296+
% labels = "Wally " + string(1:5) + ": " + string(vals);
297+
% markedSim = insertObjectAnnotation(S,"circle",[uvLoc, ...
298+
% 10*ones(5,1)],labels,FontSize=21);
299+
% imshow(markedSim)
300+
%[text] %[text:anchor:5981651E] ### 11.5.3 Nonlinear Operations
298301
out = nlfilter(mona,[7 7],@(x)var(x(:)));
299302

300303
mx = ordfilt2(mona,1,ones(5,5));
@@ -312,7 +315,7 @@
312315

313316
imshow(mona > mxn)
314317
%%
315-
%[text] %[text:anchor:8A53ACA5] ## 11\.6 Mathematical Morphology
318+
%[text] %[text:anchor:8A53ACA5] ## 11.6 Mathematical Morphology
316319
load eg_morph1.mat
317320
imshow(im,InitialMagnification=800)
318321

@@ -323,7 +326,7 @@
323326
morphdemo(im,S,"min")
324327

325328
mx = imdilate(mn,S);
326-
%[text] %[text:anchor:9676C371] ### 11\.6\.1 Noise Removal
329+
%[text] %[text:anchor:9676C371] ### 11.6.1 Noise Removal
327330
objects = imread("segmentation.png");
328331

329332
S = strel("disk",4);
@@ -335,17 +338,17 @@
335338

336339
opened = imopen(objects,S);
337340
closed = imclose(opened,S);
338-
%[text] %[text:anchor:27B57E39] ### 11\.6\.2 Boundary Detection
341+
%[text] %[text:anchor:27B57E39] ### 11.6.2 Boundary Detection
339342
eroded = imerode(clean,strel("disk",1));
340343

341344
imshow(clean-eroded)
342-
%[text] %[text:anchor:16339476] ### 11\.6\.3 Hit or Miss Transform
345+
%[text] %[text:anchor:16339476] ### 11.6.3 Hit or Miss Transform
343346
skeleton = bwmorph(clean,"skel",Inf);
344347

345348
ends = bwmorph(skeleton,"endpoints");
346349

347350
joints = bwmorph(skeleton,"branchpoints");
348-
%[text] %[text:anchor:3CB666F7] ### 11\.6\.4 Distance Transform
351+
%[text] %[text:anchor:3CB666F7] ### 11.6.4 Distance Transform
349352
im = zeros(256);
350353
im = insertShape(im,"FilledRectangle",[64 64 128 128], ...
351354
Color="w",Opacity=1);
@@ -354,8 +357,8 @@
354357

355358
dx = bwdist(edges);
356359
%%
357-
%[text] %[text:anchor:8649171A] ## 11\.7 Shape Changing
358-
%[text] %[text:anchor:F52A212B] ### 11\.7\.1 Cropping
360+
%[text] %[text:anchor:8649171A] ## 11.7 Shape Changing
361+
%[text] %[text:anchor:F52A212B] ### 11.7.1 Cropping
359362
mona = imread("monalisa.png");
360363

361364
% The following 3 lines are interactive.
@@ -364,7 +367,7 @@
364367
%roi
365368

366369
smile = imcrop(mona,[265 264 77 22]);
367-
%[text] %[text:anchor:564539E5] ### 11\.7\.2 Image Resizing
370+
%[text] %[text:anchor:564539E5] ### 11.7.2 Image Resizing
368371
roof = rgb2gray(imread("roof.jpg"));
369372
whos roof
370373

@@ -373,12 +376,12 @@
373376
smaller = imresize(roof,1/7);
374377

375378
bigger = imresize(smaller,7);
376-
%[text] %[text:anchor:57A9E901] ### 11\.7\.3 Image Pyramids
379+
%[text] %[text:anchor:57A9E901] ### 11.7.3 Image Pyramids
377380
p0 = impyramid(rgb2gray(mona),"reduce");
378381
p1 = impyramid(p0,"reduce");
379382
p2 = impyramid(p1,"reduce");
380383
p3 = impyramid(p2,"reduce");
381-
%[text] %[text:anchor:46D85206] ### 11\.7\.4 Image Warping
384+
%[text] %[text:anchor:46D85206] ### 11.7.4 Image Warping
382385
mona = im2double(rgb2gray(imread("monalisa.png")));
383386
[Ui,Vi] = meshgrid(1:size(mona,2),1:size(mona,1));
384387

@@ -438,7 +441,7 @@
438441
%#ok<*NBRAK2>
439442

440443

441-
%[appendix]
444+
%[appendix]{"version":"1.0"}
442445
%---
443446
%[metadata:view]
444447
% data: {"layout":"inline","rightPanelPercent":40}

test/book/chapter04/tChapter4.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
MLXFile = "chapter4.mlx"
1818
end
1919

20+
methods (TestClassSetup)
21+
function disableScopesWarning(testCase)
22+
%disableScopesWarning Prevent warning related to scopes opening automatically
23+
24+
import matlab.unittest.fixtures.SuppressedWarningsFixture
25+
testCase.applyFixture( ...
26+
SuppressedWarningsFixture("Spcuilib:scopeblock:ScopeNoSupportParsim"));
27+
end
28+
end
29+
2030
methods(Test)
2131
% Additional test points for the chapter
2232
end

test/book/chapter05/tChapter5.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
MLXFile = "chapter5.mlx"
1818
end
1919

20+
methods (TestClassSetup)
21+
function disableScopesWarning(testCase)
22+
%disableScopesWarning Prevent warning related to scopes opening automatically
23+
24+
import matlab.unittest.fixtures.SuppressedWarningsFixture
25+
testCase.applyFixture( ...
26+
SuppressedWarningsFixture("Spcuilib:scopeblock:ScopeNoSupportParsim"));
27+
end
28+
end
29+
2030
methods(Test)
2131
% Additional test points for the chapter
2232
end

test/book/chapter06/tChapter6.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
MLXFile = "chapter6.mlx"
1818
end
1919

20+
methods (TestClassSetup)
21+
function disableSoftwareRenderingWarning(testCase)
22+
%disableSoftwareRenderingWarning Disable warning that has no functional effect
23+
24+
import matlab.unittest.fixtures.SuppressedWarningsFixture
25+
testCase.applyFixture( ...
26+
SuppressedWarningsFixture("MATLAB:graphics:SoftwareMarkerSubsamplingm"));
27+
end
28+
end
29+
2030
methods(Test)
2131
% Additional test points for the chapter
2232
end

test/book/chapter09/tChapter9.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
MLXFile = "chapter9.mlx"
1818
end
1919

20+
methods (TestClassSetup)
21+
function disableScopesWarning(testCase)
22+
%disableScopesWarning Prevent warning related to scopes opening automatically
23+
24+
import matlab.unittest.fixtures.SuppressedWarningsFixture
25+
testCase.applyFixture( ...
26+
SuppressedWarningsFixture("Spcuilib:scopeblock:ScopeNoSupportParsim"));
27+
end
28+
end
29+
2030
methods(Test)
2131
% Additional test points for the chapter
2232
end

0 commit comments

Comments
 (0)