Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

07_ImageProcessing

0 (0 Likes / 0 Dislikes)
Welcome to the image processing part of today’s conference. In this presentation we will show you how to accomplish complex objectives using the high-level functions of the Wolfram Language. This talk has been prepared by Giulio Alessandrini and myself—Markus van Almsick. According to the subtitle, the talk consists of two parts. First, we will introduce some of the high-level functions in image processing, particularly the ones new in version 10 and those addressing volume, processing, and color processing. Next, we will utilize these functions in two non-trivial projects— in the construction of a skin detector and in the segmentation of some magnetic resonance tomography data, the volume set of a knee. Let’s start with some machine vision functions new in version 10. “BarcodeImage” and “BarcodeRecognize” allow you to construct and read a large variety of barcode formats. Here we are given a boarding pass. The boarding pass has a barcode so called “PDF417” barcode in its top right corner, which we can detect by asking “BarcodeRecognize” to provide me with a bounding box. This provides me with a bounding box coordinates, which I use in the next command that displays that bounding box. Obviously we detected the barcode and next we read it by asking “BarcodeRecognize” to just provide the data and the data here obviously is name here as passenger, the origin and the destination of the travel, the flight number, and so forth. Well, this has been easy. Now it’s just as easy to construct a barcode. But before we go ahead and try to get an upgrade here I’d like to move on to the next example. Let’s start with some of the machine vision functions new in version 10. “BarCodeImage” and “BarCodeRecognize” allow you to construct and read a large variety of barcode formats. Here we are given a boarding pass. This boarding pass has a barcode so called “PDF417” barcode in its top right corner. We can obtain its position by asking for the bounding box. We can verify that bounding box. And then last but not least, we can decipher the data of that barcode. And here we obtain information which is provided by the given passenger name, the origin of the travel, the destination, flight number, and so forth. Now before we go on and construct a barcode, I would like to move on to the next example before I get some funny ideas here of how get an upgrade and the like. Next, we address the encoding of a barcode. Anything that can be expressed as a string can be encoded as a barcode. That also holds true for Wolfram Language code. This particular case we take a one-liner written by Lingchuan Chen from Beijing, China— this is the code that it’ll manipulate which we then put in a “ToString” command that converts it to a string. And that string is then converted to a barcode image of format QR, which is essentially not a barcode but a 2D code—two-dimensional code— which we here decipher again and convert into an expression. Here we run the expression and as you can see this barcode encodes a little manipulate and interactive program to generate a fractal tree. The most ubiquitous segmentation task, image processing, is the separation of foreground and background and that’s what “RemoveBackground” actually does. It takes an image like this one here and a hint, like what the foreground or background property is, in this case we say that the background is a green background and then “RemoveBackground” provides us with an image where the alpha channel basically blends away the background. Such an image can then readily be used in a command like “ImageCompose”, where we place it in front of a different background, like this. The most ubiquitous segmentation command in image processing is the separation of foreground and background and that’s exactly what “RemoveBackground” does. “RemoveBackground” takes an image and then a second argument that helps us to specify how the background looks like. In this case, we say the background has a typical green appearance. That’s all it needs and we are provided here with an image where the background is blended away via an alpha channel. And that alpha channel can now be used or that image with the alpha channel can be used in a command like “ImageCompose” to place it straight in front of another background—in this case, a galaxy. In this particular example, we use “RemoveBackground” in a little more sophisticated way. Here, we have an image of flamingos in front of a grey sky. We do not specify the color of the sky of the background; we simply specify that the background has a uniform structure that only varies up to 10%. This is sufficient for the segmentation of the birds. But just to play it safe and in order to avoid the capture of any small fragments due to noise, for example, we plug this into a “DeleteSmallComponents” command that takes out any kind of small segments and that way we obtain a fairly clean segmentation of those flamingos. Now in order to count those flamingos automatically, we go ahead and use the most logical component command. That component command basically assigns labels to every contingent segment we have in this image so we assign “label 1” to this bird and “label 2” to this bird and so forth and just by extracting the highest label we extract the level of birds. And here please verify that we have 10—1, 2, 3, 4, 5, 6, 7, 8, 9, 10 birds at hand. “RemoveBackground” has done a fairly good job in this last example. However, one can do better. That’s why I would like to introduce you to the “GrowCutComponent” command. Again, we take the same very image—the image of the chameleon. But now we do not specify the background by saying that it’s blurred but we take a marker image, a marker image for the background just giving a few strokes, where we find the background and an image for the background, again, given by a few markers that would fit just exactly here onto the chameleon. Now this just gives us a rough segmentation idea and now “GrowCutComponent” provides us with a very detailed, very exact and nice segmentation of the above image. As you can see here, it provides us with a label matrix, that label matrix I plug into this image here, which then generates an alpha channel of the above image and we see the result. And the result is a delicate segmentation of the chameleon with every detail preserved. If you have several images at hand and you would like to display them at once you are faced with the problem of creating a collage. This is a trivial problem if you have images of the same size and format, but it becomes harder if the images have different aspect ratios and different sizes. In this case, “ImageCollage” can help. “ImageCollage” basically takes a list of images, you can specify a method, how to arrange the images—several are available— you can specify paddings if you like and other options, and you can specify the resampling to be applied if images have been enlarged or reduced. In this case, wr sort images by rows and obtain this result or we sample them by column and we obtain this result. “ImageCollage” cannot only help to display several images at once, it can also convey data, data like in this case—the population of an EU member state. Here, we generate all of the EU member states— their population and their corresponding flag. As you can see, the population of Austria is 8.4 million and the Austrian flag, Belgium, and so forth. Once we have all this data, we can basically provide this to “ImageCollage” and “ImageCollage” will resize the flag according to the population. And we obtain this result. As you can see, the largest population in the EU is Germany, followed by France, Italy, Britain, Great Britain, Spain, Poland, and so forth. Now we obtain a completely different image if we take the data weighted by the area of the country size. In this case, the collage looks like this. And here you clearly see that countries that were small beforehand, like Sweden, end up to be rather large. Please let me now address “ImageRotate”. Now “ImageRotate” is clearly not a high-level function nor is it new to version 10. Nevertheless, it has a few nice options now that clearly show that development is not going on in new functions but also in old ones. Let’s assume a typical problem— we have taken a image on your last trip and you find out that the horizon in that image is not perfectly horizontal. In order to rectify this problem, you have to rotate the image. Here we assume that we know the exact angle and you find out that you get a nice result but, unfortunately, you get this padding problem. You have lots of leg areas and background areas that don’t necessarily look good. Now there are different ways to get rid of this padding or these background areas, you could at first pad but there’s no good padding in this case. This would be one, for example, reflected padding and you clearly see here that you still have some edge on the top of the image; if you pad here, like in reverse, you basically mirror the horizon across this border and that’s clearly not what you want to do. So, if padding or an intelligent padding is not the solution, you’re forced to crop. And now there are different ways to crop, intelligently crop, results of image rotate. First, one that has been there before is full cropping, which basically means that you take the image and reduce it to its original size. So you basically crop, you still have left some background part here and here but nevertheless it is less. But, well that’s probably not what you want. you may want is to do a cropping that preserves the aspect ratio of the image and that is done here by this string, quoting that you’d like to have the same ratio cropping. Clearly, the image is smaller but it is a perfect image and you don’t have these nasty black triangles the edge and you get what you want. There’s another way to obtain such a result If you’re not interested in preserving the aspect ratio you may also ask to maximize the area being displayed and this would give you this particular image, which is the largest right angle in the rotated image that still fits in there without displaying any background. Let’s return to truly high-level functions And now, we address those that can cope with 3D images with volumetric data. So, up front, we need some volumetric data and here we have a dataset that displays vertebra a segment of a vertebra obtained from a CT image and you clearly see here the hard bone shell and some trabecular bone structure inside So that’s the dataset we work on now and I will just simply demonstrate some of the high-level functions by working on this example So, up front, I’d like to identify some small compartments in this trabecular bone structure that would host the bone marrow How do I do so? Well, first of all, I have to specify what a compartment constitutes a compartment and here I simply say that well a compartment is made up if the bone structure or the density around it is at least 1% higher then the center or the minimum of that compartment So that’s what I specify here. Then, next, I regularize the data of the bone by performing a Gaussian blur there by reducing the noise level in the data and then I perform a “MinDetect”, a “MinDetect” on the regularized data where I basically say that I only like to specify those minima that have at least a depth of 1%. Thereby I only detect minima that are within the compartment of compartment wall that is 1% above the minimum itself. And all of these minima that I detect here then functions as seeds in a “WatershedComponent” algorithm that gives me the complete compartment, which I basically then display here as an image 3D object with a bit of coding and in order to basically then display the compartment walls I simply perform a “ColorNegate” on that volume. So let’s see what I obtain Here nicely we can see here the compartments themselves. And, well to make the whole thing look better, I can edit the color function, which provides me with this color function editor. I can increase the opacity or decrease the opacity of the void , I can change the color, and apply this to the data and then view this with a different color function and now clearly I can see the compartments that I just segmented much better As the next step I may be interested in the solid bone material and I segment that again by regularizing the data a bit more than before by basically doing a basic threshold algorithm by binarizing the data, the threshold being 0.25 and by making sure that I delete small components due to noise with the well known “DeleteSmallComponents” command And this basically would be then the area that would constitute the solid bone Next, I can basically subtract this area from my original data and there by obtaining the trabecular bone part of that vertebra. I do so by simply taking the bone up there, doing color negation of the dilated version of the hard bone here,

Video Details

Duration: 45 minutes and 59 seconds
Country:
Language: English
License: Dotsub - Standard License
Genre: None
Views: 22
Posted by: wolfram on Apr 15, 2015

07_ImageProcessing

Caption and Translate

    Sign In/Register for Dotsub above to caption this video.