# Thresholds for a thermal image

5 views (last 30 days)
Hi, i have few thermal images of concrete structures with internal defects. I want to segment defects in that image in which few are brighter and few are darker then background. my images are
http://i43.tinypic.com/jfkho7_th.jpg From the first image i need a binary image that should have the black spot left side, along with two regions close to it. can any one tell me how to get thresholds for such images....
I have read some papers on adaptive thresholding, in which they have mentioned about global and local thresholding. I dont know how to start coding, can any one please suggest me with some example codes of adaptive thresholding so that i can go further.
any suggestions will be appreciated,

Geoff on 2 May 2012
My advice is to start with the simplest approach and run with it until you can't go any further. THEN look at the more complex approaches. You want to get results ASAP, without spending days scratching your head over insane code.
The local expert Image Analyst may have some real suggestions for you, but until he comes along I'll throw some simple ideas out...
The middle of those three pictures does not seem to be available, so maybe I'm confused because of that. Is the third image your background? Do you collect these from continuous video or do you just get a couple of snapshots?
Image 3 looks very different from Image 1. I know nothing about your field, but I'm going to assume that Image 3 is an initial reading, and Image 1 is a later shot after heating the concrete up.
First, you probably want to convert these images into greyscale if they're not already. I don't know what the formula would be for that heat pattern, but you just want one number for each pixel (maybe you have that already). To me it looks like it uses the entire blue range, then red comes in while blue goes out, then green comes in with the red maxed out.
If you want to try basic background subtraction, then normalise both images and take:
diffim = abs(image1-image3);
That'll probably be quite noisy so you would want a way to filter the noise out: ie detect minimum threshold. I'm no mathematician, but maybe standard deviation is useful here.
To do a global threshold, you just choose a number. Let's call it threshold. Then you cut all points above (or below) that. Since you have a difference image, you want to select only those with large differences:
defects = difim >= threshold;
Adaptive thresholding, as I understand it, is where your threshold value changes across the image. So instead of a single number, your threshold variable is another image. Presumably you'd want this because you need a larger difference at higher temperatures to consider a spot as a defect?
Anyway, you might generate this by convoluting the background image with a large-ish smoothing filter and taking the log of that, perhaps... That's the limit of my understanding of thermal energy! =)
smoothkernel = ones(20);
threshold = log(conv2(image3, smoothkernel));
Hope this is a help. It could be a start, if you currently have nothing =)
Thank you Geoff.
sorry that, the middle image is lost i think. They are all different input images. And i just uploaded them as example images that i have got from papers on my project, so that you may get an idea of the picture.
yes, we have to 1st convert them to gray scale images and then we have to segment them. but, in segmentation i want some black regions also as in the 1st image to be my objects of interest. i use rgb2gray function in "matlab" for the conversion. in binarization i have tried changing the threshold values, but black regions are not detecting as objects.
[URL=http://www.pictureshoster.com/][IMG]http://www.pictureshoster.com/files/n8a6lpwh7l6js9xo3brf.jpg[/IMG][/URL]
this is the second image, and there is another image from which am easily able to segment the defects because they were bright.
[URL=http://www.pictureshoster.com/][IMG]http://www.pictureshoster.com/files/czuz9r64z17ydditlwmr.jpg[/IMG][/URL]

Image Analyst on 2 May 2012
If you have the Image Processing Toolbox, you can do adaptive thresholding by first doing contrast limited local adaptive histogram equalization (CLAHE) which is performed by the function adapthisteq(). See the examples in the help. You may have to experiment with the parameters to get it just right, and of course youll have to use the monochrome image, not the pseudocolored image. Now you have a flat field and you can use a global threshold. See how that works. There are other ways to proceed if that doesn't work well, though those might not be much better.
##### 3 CommentsShow 1 older commentHide 1 older comment
hi image analyst, as i was working on thresholding of thermal images, i have read a paper with title "A robust fully automatic scheme for general image segmentation" from the link 'http://www.sciencedirect.com/science/article/pii/S105120041000076X' and i started implementing this method.
In this method, i have done coding up to global thresholding and finding the initial points.
in the 3rd step(Determining the local threshold Tl), i found the average of all the gray level differences at each pixel. then "Tl m,n" is computed. i am unable to understand further the equation(equation-9) to find local threshold.
Later in the Modified Edge Following scheme, i don't understand (dh,0+4)mod8. what is mod8 representing here? can u please help me out. if you want i can post my code till what i have done.
thank you...
Image Analyst on 14 May 2012
It's the modulus function, as described in the help. Basically, the remainder after you divide by 8.

### Categories

Find more on Image Thresholding in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!