How can I segment bones from an x ray image? - matlab

I want to remove the skin particles from my X-Ray of hand image. I want bones as white Color and all other areas including the skin area in the x ray as black. I am doing my project in mat lab.

You can use this script for Local Adaptive Thresholding.
Or if you want bones as white color you should use sobel-operator, as in this example.

A simple way,you can just change the value of a pixel, when it is higher than 125 change it to 255,or set 0. the number 125,you can change it,to get a best one.
you can search "binarization" on google to get more information.

Related

How to use a texture with particle system to create lightnings effect?

I have a lightning texture tga file type :
and i dragged the lightning texture to a new particle system :
two problems :
how to make the 3d start size to be random ?
from youtube tutorial he did something that give him a random settings ine the 3d start size:
but my 3d start size is not random and i'm not sure how to apply the random settings :
the second problem is how to display the lightning in the particle system without the black box square around and to show only the lightning ?
For the first question, I can't say much more than try to play with the parameters in the same section "Shape" where you can change the "randomize" parameters.
For the second question: Do you see that "Alpha Is Transparency" check mark? Yes, that's it. Solves your problem ;)
For the first problem the random on the 3D Start Size.
on the right of it there is a small arrow click on it to expand and then you have some options, select Random Between Two Constants or play with it with the other options. then you can set the X and Y and Z random ranges.
I marked with red circle the arrow to click and expand to get to the options.
The second problem was the box(cube) in black around the lightning.
to remove it just go to the object with the particle system scroll down to the bottom to the shader, expand the shader options and in Rendering Mode change it to Transparent.
I marked with red circle again on the right what you have to change to make it transparent.
and we have nice lightnings and this is the basic i guess but it's working nice.

Detect the position,orientation and color in Matlab of not overlapped Tiles to be picked by robot

I am currently working on a project where I need to find the
square shape tiles in pile which are not overlapped,
am currently working on a project where
I need to determine the orientation , position (center ) ,and color
of each square tile . These orientation and positions
will be used as input for a robot to be picked
and the robot will sort them in a specific locations .
I am using Matlab and i should transfer the data using TCP/IP.
I've experimenting with edge detection(canny,sobel) ,
found the boundaries,segmentation using threshold and FCM but
I haven't found a reliable way to determine the tiles which are
not overlapped ,i am trying to use template shape matching but
i don't know how to do that . This needs to be done in real time
as i will be using frame which is taken from a USB camera that
attached to PC . I was wondering if someone could offer a
reliable solution ? Here is a sample image.
I was wondering if someone could offer
a reliable solution to determine the square shape tiles
which are not overlapped? Here is a sample imageoverlapped Tiles
You've separated the image into tiles and background. So now simply label all the connected components. Take each one and test for single tile-ness. If you know the approximate size of the tiles, first exclude by area. Then calculate the centroid and the extreme left, right, top and bottom. If it is tile, the intersection of top bottom and left-right will be approximately in the centroid, and the half angles will be perpendicular to the tile edge. So rotate, take the bounding box, and count unset pixels, which should be almost zero for a rectangluar tile.
(You'll probably need to do a morphological operation or two to clean up the images if the tile / background separation is a bit dicey).
Check out the binary image processing library http://malcolmmclean.github.io/binaryimagelibrary 1
thanks for your quick replay.i already did some morphological operation and found connected component and below is my code in matlab ,and each tile has 2.5*2.5 cm area
a = imread('origenal image.jpg');
I = rgb2gray(a);
imshow(I)
thresold = graythresh(I);
se1=strel('diamond',2);
I1=imerode(I,se1);
figure(1)
imshow(I1);
bw = imclose(I1 , ones(25) );
imshow(bw)
CC = bwconncomp(bw);
L = labelmatrix(CC);

How to use a different texture on intersecting part of 2 quads

I'm looking for a way to dynamically change a part of a Quad that has a SpriteRenderer attached to it. Let's say I have a red Quad and a blue Quad, and then I drag one onto the other (fast or slow), the intersecting part should be colored using a green sprite. This illustration shows the scenario I'm trying to solve.
Can someone please help me with this?
You have two options:
First, if your mid color will be the correct mixture of other two color, in this case it would be yellow, you can use Mobile Particle/Additive or Mobile Particle/Multiply Shaders.
In a second way, you can write your own shader that takes the intersection area as parameter and paint your textures according to parameters.

How to get the region shown in the image ?

i want to get the red region as specified in the image below :
remember that the red region that is shown in the image is just for clarification , it is not present in original image , below is the original image attached :
i also have the iris point in this region, i already got that point , if that point can help me so i can share that image too.
can someone help me in this .....
For this specific image, let's call it BW, you can find the center region as:
BWnoBorder= imclearborder(BW); %# remove the white that touches the border
OnlyCenter = bwareaopen(BWnoBorder,1000); %# remove all small pixel areas
A robust method might be the snake region growing algorithm.
Seems like you thresholded the eye illuminated by IR or something. To answer your question or even to ask it correctly you have to show a number of images to evaluate the stability and noise in eye socket regions. Otherwise one can come up with a solution that works for the image above but not in general.
For example, I can invert your image, get the largest Connected Component (the dark region) and erode it till it becomes thin, see below. It is easy to get an ellipse from this binary mask but will it work in general case with your noisy input?
A good thing to start is to say what do you expect to find. Say you are looking for an eye, dark surrounding area and a bright skin tone - make it 3 Mixed models that settle simultaneously in the EM fashion. Provide some shape priors to increase accuracy. think about other visual cues such as specs on the iris, saccades, FA from blinks, etc.

Matlab color detection

I'm trying to consistently detect a certain color between images of the same scene. The idea is to recognize a set of object based on a color profile. So, for instance, if I'm given a scene with a green ball in it and I select that green as part of my color palette, I would like a function which has a matrix reflecting that it detects the ball.
Can anyone recommend some matlab functions/plugins/starting points for this project? ideally the function for color recognition will take an array of color values and will match them within a certain threshold.
Kinda like this:
http://www.mathworks.com/matlabcentral/fileexchange/18440-color-detection-using-hsv-color-space-training-and-testing
except it works (this one didn't)
Update:
Here's why I chose not to use the above toolkit..
I start by selecting some colors of interest in the picture
and then ask the function to recognize the road in later images...
And absolutely nothing useful is triggered. So yeah, apart from the few bugs that I came across in the code on download and fixed, this was kind of the kicker. I didn't try to fix the body of the code that recognizes the colors because.. well, I don't know how, which is why I came here.
So, let me just start off by saying road detection with color profiles is a pathological problem. But if the color of the roads are consistent, and the lighting doesn't change the color of the object you are trying to recognize then you might have a shot. (this will be extremely difficult if this is taken outside, or with different cameras, or if shadows happen, or it taking place in any sort of real-world environment)
Here are a few things that might help.
Try smoothing the image beforehand, the reason you get the bad results in the first images is probably because of small pixel variations in the road. If you can blur them, or use some sort of watershed or local averaging, you might get regions with more consistent color.
You might also consider using the LAB color space instead of HSV or RGB.
Using edge detection (see matlab's canny edge detector) might be able to get you some boundary information. If you are looking for a smooth object, there will not be very many edges in it.
Edit: I tried to adhere to this advice in the most simplistic way. Here are the resulting code and a few samples.
im=rgb2gray(im) %for most basic color capturing.. using another color space is better practice
%imshow(im)
RoadMask=roipoly(im)%create mask
RoadMask=uint8(RoadMask);%cast to so you can elementwise multiply
im=im.*RoadMask;%apply mask
[x y]=size(im);
for i=1:x
for j=1:y
%disp('here')
if (im(i,j)<160 || im(i,j)>180) %select your values based on your targets range
im(i,j)=0; %replace everything outside of range with 0
%disp(im(x,y)) %if you'd like to count pixels, turn all values
end %within range to 1 and do a sum at end
end
end
First converted from RGB to grayscale
selected a region that generally matched the roads grayness
Notice parts of the road are not captured and the blocky edges. such as this -------------^
This implementation was quicky and dirty, but I wanted to put it up before I forgot. I'll try to update with code that implements smoothing, sampling, and the LAB color space.