slicing a 3D image data set at different angles [duplicate] - matlab

This question already has answers here:
Extract arbitrarily rotated plane of data from 3D array as 2D array
(2 answers)
Closed 8 years ago.
I am working with a 3d stack of CT data. I'm interested to define a plane and slice this 3D image dataset with this plane. I'm using MATLAB to do this. I have attempted a few different approaches, including rotating the image data set prior to slicing it, however, imrotate() only rotates the image in one direction (about the z-axis I believe).
I have also tried defining the plane and intersecting it with each image slice and defining the data points by interpolation. I thought and still think this is a clean way of approaching the problem, however I have not succeeded in finding out why the approach is not working. I understand that my image is defined as coordinates, while when I try to define the plane MATLAB does this through dimensions. As straightforward as it sounds I have been struggling with figuring out the solution for a while now.
I appreciate any help guiding me to a solution.
Thank you in advance!

I would strongly recommend using ITK (http://www.itk.org/Doxygen41/html/annotated.html) for working on medical images. MATLAB is not very helpful when working with large medical images. There are varuous filters in ITK which cna solve your purpose, e.g., ExtractSliceImageFIlter... May be a simple cropping is what you want... Its bit of a pain to learn ITK initially but totally worth it... refer the ITK Documentation and examples... all the doubts that you have about using any function etc can be understood by looking at solved examples give...

http://www.mathworks.com/products/demos/image/3d_mri/tform3.html
i hope this help,
i would also go with magarwal suggestion , matlab people are usually taking ITK filters and implementing it in Matlab,
so if you have C++, java, python , c# or any skill of the above you can use itk .
and Trust me you will be ahead than Matlab while waiting for them to implement filters they already have in ITK

Related

ideas on quadrangle/rectangle detection using convolutional neural networks

I'v been trying to do quadrangle detection and localization for weeks, my goal is to have a robust way of getting the 4 points of an quadrangle(rectangle), so I can apply projective transform to an Image then attach it to the source image. I have try the classic opencv contour method, and also using hough transform to find lines then calculate intersections, those two methods is unusable when apply it to real life images.
So I turn to CNN for help, but currently i haven't find any one try to use CNN to solve this simple problem.
My first attempt is to use state-of-art object detection and localization methods to get quadrangle's bounding box so i can narrow the search of 4 points, then use image processing & computer vision methods to further the search for 4 points. but after trying YOLOv2 and Faster-RCNN, the prediction accuracy is not ideal.
So I'm wondering if there is any idea i can do this end to end, training and feedforward all using a single neural network. it also must be able to deal with occlusion reasonably well.
Currently my idea is to remove the fc-layers and make a huge activation map that has the same width and height as the first input layer(eg. 448x448) then optimize the 4 most highly activated areas, using argmax to get the position. but this method only works for one quadrangle it doesn't work well with corner occlusions as well.
I'll be appreciated if anyone can provide any suggestions. Thanks a lot!
You are absolutely right about the first methods you mentioned. Hough transform like methods are old and not useful for images in the wild. And of course, computer vision field turned its face to object detection and recognition with rise of deep learning.
However, there is a very nice discussion came up recently.
Have we forgotten about Geometry in Computer Vision?
My suggestion would be contour detection and then apply Hough transform(use state of the art) methods to detect rectangles you want, about the occlusion, you can set parameters for Hough transform to be more forgiving for missing edge pixels with parameters.
You can for example check most recent contour detection methods as in recent CVPR paper.

how to create a nature shape in matlab?

i am a newbie here.. please excuse me for asking a straight forward question as i did not have the right information to do so.
for my question above, can anyone help me to create various shape in matlab?
i know how to make a simple triangle, rectangle in matlab.
what i am looking for is how to create animal patterns in matlab. all i need is the boundary layer (outer layer).
like from a bird / butterfly. something like the picture below.
butterfly wing:
can anyone give me tips / links to help me.
and yes, i also did not have the coding. i am totally lost on how to make the pattern in matlab.
my real purpose was to add mesh pattern into the wings. i have the code for the mesh. all i need is the code on how to make the wing shape.
If you already have the image created by another program, you can import it to matlab using imread. If you then want to get a binary boundary, you can use im2bw.
threshold = 0.7; % you can play with this to get what you want
binary_img = im2bw(imread('PATH\TO\IMAGE.jpg'), threshold);
In matlab versions starting at 2016a there is another function called imbinarize you might want to have a look at.
As for creating patterns from scratch, as already mentioned in the comments, matlab should not be your choice. Unless, of course, you have a well defined mathematical equation or a problem solution to which becomes the boundary. For this you can look into fimplicit, fplot etc..

Find correspondence between two sets of 2D points

I have two sets of 2D Points (shown in images below).
And I would like to find some high confidence correspondence between these dots.
These dots are extracted feature points from 2 camera images from different angles. Two images are relatively well rectified, though not perfect. However, there will be distortion/warp caused by depth in the scene, the number of points might not be the same, there might be outliers, etc.
One approach could be using a sliding window that contains multiple dots and try block matching. But that might be kind of slow. I feel like there should be a relatively straight forward solution to this problem.
For example, this paper might be addressing a similar problem.
You can use each dot/point in one of the images, and search for its "neighbors" in the other image.
Just a few days ago someone asked a similar question here, and got a very sophisticated (accepted) answer:
How to calculate the nearest neighbors using weka from the command line?
But maybe your problem is so common in image processing that there are even better solutions, but you might try this one (implemented in java).

Matlab face alignment code

I am attempting to do some face recognition and hallucination experiments and in order to get the best results, I first need to ensure all the facial images are aligned. I am using several thousand images for experimenting.
I have been scouring the Internet for past few days and have found many different programs which claim to do so, however due to Matlabs poor backwards compatibility, many of the programs no longer work. I have tried several different programs which don't run as they are calling onto Matlab functions which have since been removed.
The closest I found was using the SIFT algorithm, code found here
http://people.csail.mit.edu/celiu/ECCV2008/
Which does help align the images, but unfortunately it also downsamples the image, so the result ends up quite blurry looking which would have a negative effect on any experiments I ran.
Does anyone have any Matlab code samples or be able to point me in the right direction to code that actually aligns faces in a database.
Any help would be much appreciated.
You can find this recent work on Face Detection, Pose Estimation and Landmark Localization in the Wild. It has a working Matlab implementation and it is quite a good method.
Once you identify keypoints on all your faces you can morph them into a single reference and work from there.
The easiest way it with PCA and the eigen vector. To found X and Y most representative data. So you'll get the direction of the face.
You can found explication in this document : PCA Aligment
Do you need to detect the faces first, or are they already cropped? If you need to detect the faces, you can use vision.CascadeObjectDetector object in the Computer Vision System Toolbox.
To align the faces you can try the imregister function in the Image Processing Toolbox. Alternatively, you can use a feature-based approach. The Computer Vision System Toolbox includes a number of interest point detectors, feature descriptors, and a matchFeatures function to match the descriptors between a pair of images. You can then use the estimateGeometricTransform function to estimate an affine or even a projective transformation between two images. See this example for details.

Object detection/recognition using matlab [duplicate]

This question already exists:
Closed 10 years ago.
Possible Duplicate:
Object recognition system using matlab
I need help to develop an object recognition system. It needs to identify an object in an image by comparing it with an image in an existing database. For example my database may consist of images of cars, buses, cups, etc. If i give a certain image as an input i want the code to check and tell me whether a car(as in the car in the database) can be found to exist in the input image or not. This is strictly to be implemented in matlab. I have tried correlation, image subtraction and a few other algorithms but to no effect. Thanks in advance.
This is a complex subject, that is really on the bleeding edge of technology, but let me give you a few pointers to help start things out.
Somehow, you need to take into account the different sizes, angles, etc that might be around. A car looks very different if photographed from a few feet away as compared to 50 feet, as would it photographed from the front vs the side.
Edge detection algorithms generally work well at pulling the target object's shape away. Take the edges, identify lines in them, and you can try to compare these lines with those from your model.
Range to objects really makes a huge difference in building a successful algorithm. If you know the difference from the front of the car to the back, it can make all of the difference in the world.
Focus, noise, lighting, etc need to somehow be dealt with, to ensure that the system works well.
All in all, I would recommend taking some image analysis classes, reading several papers on the subject, or at least reading the Wikipedia Article, and then starting to work on your project.
The problem you have described is sometimes called object category recognition or object class recognition to emphasize that you are not trying to recognize a particular object, but a member of a category such as "car" or "person".
One popular approach for solving this problem is called Bag of Features of "Bag of Words". If you have access to the Computer Vision System Toolbox for Matlab, it has functions for detecting SURF features, which can be used for this approach.
Also, a better place to ask this question might be Signal and Image Processing stack exchange.