Matlab: Image background removing and cutting

(German) This post is about a Matlab function where one can load an images and remove the background, by saving it as a transparent image. The background can consist out of different and blurring colors! Useful for prensentations that the image fits to the slice background.

Mode of operation:

This is a GUI based function, so that one can load via interface an images of any type. Now one can use the buttom "Choose BG" to select the background color in an additional appearing image. If it is chosen one see in figure 2 the extracted regions in white and in the lower left corner which color was selected. If one uses now the slider one can increase the range of the color. If the value is 10 and the chosen background color is [50 5 200] then the algorithm is also selecting every pixel with the colors between [40 0 190] and [60 15 210]. This is also seen in the lower left corner. 
The buttom "next BG" can be used to select a second additional background. Therefor one can also increase the variability of the color selection. 
After the background is selected one can save the image via the buttom "Save Transparent".
This is seen in following image:




If one is saving the image one gets this:
  

This function can be downloaded from this link which also contains the GUI interface .fig file.

Kommentare

Beliebte Posts aus diesem Blog

Easy Plots in HTML/PHP with Google Charts

Matlab: 3D Coordinate System Rotations with Vectors

Matlab: Dijkstra methode - shortest way on gradient (small neighborhood)