> library(crackrec) # Reading and converting the bmp file > zigzag<-rbmp("S18_B40_X=61.950_Y=211.500_A.bmp") # 1. Approach # Removing shadow with shadow.remove > zigzag.sr<-shadow.remove(zigzag) shadow on the right hand side has been removed shadow on the top has been removed # Calculating the crack clusters and crack paths > res.sr<-crackrec(zigzag.sr, threshold=140) max. crack length: 305.776855 835 cracks found # Plotting the crack paths in the image > image(1:696,1:512,zigzag,col=gray((0:32)/32),xlab=" ",ylab=" ") > crackplot(res.sr$crackpaths,res.sr$cracks) # 2. Approach # Removing shadow with the median filter # Please not that the implementation of the median filter is slow and can be improved > zigzag.med<-medianfilter(zigzag) # Determining the threhold with the method of steepest increase > threshold.msi(zigzag.med,bw=30) [1] 143 # Calculating the crack clusters and crack paths > res.med<-crackrec(zigzag.med, threshold=143) max. crack length: 299.291595 1091 cracks found # Plotting the crack paths in the image > par(cex=1) > image(1:696,1:512,zigzag,col=gray((0:32)/32),xlab=" ",ylab=" ") > crackplot(res.med$crackpaths,res.med$cracks)