MATLAB: How do I resize (connected) components in a 3D binary image sequence without changing the dimensions of the sequence? - matlab

I'd like to resize the components contained in a 3D binary image sequence without changing any of the dimensions of the sequence itself.
I'm not sure if I need to do it on a component-by-component basis, if yes, then how do I create a transform such that the resized components are re-positioned 'correctly' in the image sequence? By 'correctly', I mean with the same centre of mass as the original unprocessed components.
(If that last paragraph doesn't make sense then please ignore)
A 2D example: suppose I wanted to enlarge by 10% the white blobs in the following [295x445] image
How would you do this without making the image itself larger?

you could use the imdilate function to dilate the regions of interest. The examples in the webpage show how to use this function.

Related

Scanned text blurred characters correction

Could you please advice what image processing transform can I use in order to correct character blurring after text scanning? Afterwards, i am planning to remove uneven background illumination using top-hat transforms.
You need spatially dependent deconvolution. I think, the point scattering function (PSF) here is ellipse (in left part of image).

Image segmentation algorithm in MATLAB

I need to implement an image segmentation function in MATLAB based on the principles of the connected components algorithm, but with a few modifications. This is intended for very simple, 2D images, with a background color and some objects in different colors.
The idea is that, taking the image as a matrix, I provide a tool to select the background color (it will vary for every image). Then, when the value of the color of the background of the image is selected, I have to segment all the objects in the image, and the result should be a labeled matrix, of the same size of the image, with 0's for the background, and a different number for each object.
This is a graphic example of what I mean:
I understand the idea of how to do it, but I do not know how to implement it on MATLAB. For each pixel (matrix position) I should mark it as visited and then if the value corresponds to the one of the background, assign 0, if not, assign another value. The objects can be formed by different colors, so in the end, I need to segment groups of adjacent pixels, whatever their color is. Also I have to use 8-connectivity, in order to count the green object of the example image as only one object and not 4 different ones. And also, the objects should be counted from top to bottom, and from left to right.
Is there a simple way of doing this in MATLAB? I know the bwlabel function, but it works for binary images only, so I'd like to adapt it to my case.
once you know the background color, you can easily convert your image into a binary mask of the same size:
bw=img!=bg_color;
Once you have a binary mask you can call bwlavel with 8-connectivity argument as you suggested yourself.
Note: you might want to convert your color image from RGB representation to an indexed image using rgb2ind before processing.

Morphological operation to improve the shape of segmented image

I have an ellipse in the image.After segmentation i got a broken ellipse as shown .which morphological operation is used to get the perfect ellipse
Actual input file is
output obtained is
i tried imopen ,but i will lose lower ellipse like structure .how to close the upper ellipse like structure without losing lower ones
Mask i created is
i want to segment the ellipse like structure.but some of these structures are connected with rectangular like bodies.how to separate it. erode will eliminate small ellipses
If you want to reconnect something with a mathematical morphology operator, do not use an opening (it increases the gap), but a closing (imclose)! The names are explicits.
In you case, you want to reconnect something vertically cut, so use a horizontal structuring element (type segment).
And yes, you have to invert your image, black pixels representing the absence of information.
Usually, for closing gaps, you would need the close operator.
However, since most software assume active pixels are white, you would either need to invert the image, or use the open operator.
On this image, in matlab, the following works well:
imopen(I,ones(32))
This uses a square structuring element. You may want to experiment with other shapes.
Your example also looks like you moved half of the ellipse, as opposed to some process which deleted pixels in the middle. No simple morphological operation can create a perfect ellipse out of the sample image, unless you use the knowledge that multiple components can be moved to re-form the ellipse. If that is the actual case, you can scan connected components and try to match them together.

Create label for conical surface

Is it possible to create labels for conical surfaces in MS-word.
I have a label ready, but it needs to adapt to that the printed label can be pasted on a conical surface (e.g. a coffee cup)
I doubt it. You could try using WordArt: these are predefined shapes, maybe one of those matches what you want to do.
I suspect you'd be better off using a program like Adobe Illustrator, which can convert text to vector images which you can distort any way you like.
The bigger problem is that the label won't fit properly on a shape that is curved in two dimensions: you'll always have folds somewhere.

How do I turn an image into a vector on the iPhone like Adobe Illustrator's Live Trace?

I want to be able to create vector files like Illustrator does on the iPhone. Does anyone know of an algorithm?
for each pixel try to grow by testing against it's neighbours for colour similarity with a threshhold. keep growing until no more expansion is possible due to threshold then you make a path using the outermost border pixels. Now repeat for the other pixels in the orignal raster image which were not already included in your previous expansions.