detecting specific shape using simulink - matlab

i am using simulink to implement image processing(edge detection and hough transform) in detecting and tracking object. after i implement the model it works fine,but now i want to detect a specific object for example circle shape (ball) or any other shapes.
the blocks i used for my model are:
from video device
color space conversion
delay
subtract
abs
constant
matlab function
gaussian filter
edge detection
histogram equalization
logical operator
hough transform
data type conversion
blob analysis
draw shape
to video display
which simulink block i can use to specify the object and how to do it?
your support and help is highly appreciated and i need the solution as soon as possible..
regards
Mohammed

Related

Detect shapes based on their equations in an image in MATLAB

EDIT: Detection of triangle, rectangle/square or any other with sharp edges can be detected, but I'm not getting how to detect the spiral.
Is it possible to detect different shapes based on the general equation of the shape. Like for example if I give a general equation of a circle/ rectangle/ triangle/ spiral or any other shape, is it possible to detect that shape in an image?
For example if I give a general equation of the shapes, it should detect the shape in the image.
More precisely defining the problem: If I give a general equation of a triangle, it should detect the triangle and mark it.
Here's a sample input image.
I know that using some morphological analysis and edge detection is very easy for this but I have to use curve fitting, but I'm not able to know how to start, can anyone please provide an algorithm or a snippet please.
You get line detection using the hough() function and circle detection using imfindcircles() in the Image Processing Toolbox.
Alternatively, you can turn this problem around: first detect objects of interest by some means, e. g. by color, and then try to identify their shape. The regionprops() function can compute many different shape characteristics for you.
And if all else fails, you can write your own Generalized Hough Transform

MATLAB: Using hough transform to detect circle

I am writing a matlab code that takes in a photo and detects the circular object. For example, the function takes a picture of a peach (circular object) as an input and will return the same image with the peach circled.
Currently, I am using hough transform, utilizing imfindcircles function. However, this function requires me to specify radius range and some sort of sensitivity/threshold value. These values differ for different sizes of image and round objects. So, to get the desired output, I will have to manually change these values for each input image, which is not what I want. I'm going to use this function on 100+ images, so it's impossible for me to do this manually.
My question is is there any way I can make my circular object detection function less manual and possibly completely automatic (does not require me to input any values, just the image)?
Complexity of circle detection
The Hough transform is a voting procedure that requires assumptions be made about the minimum and maximum radii of your circles. Generally speaking using the Randomized Hough Transform for Circles you would pick three-points and then try to form a circle and check if the radius is within the desired range. Running this for a good number of iterations you should find peaks (multiple hits) in your accumulator matrix that represent circles. If you didn't make any assumptions about object size I think it is obvious this method wouldn't work.
Do some routine pre-processing to adjust for contrast and brightness e.g. contrast stretching, histogram equalization. If you might have some noise in the images, then apply bit of gaussian smoothing as well.
Normalizing images this way will reduce inter-image variance and help you with setting thresholds.
the Hough Transform can be used to detect circles, lines, etc.You can refer the demos in Matlab. There are several cases for the application of Hough Transform.

Detect low-quality circles/rings in image with MATLAB

I'm trying to find all the cylindrical objects in an image which represents a map. Only their edges can be seen on the map and they can be very poor.
The aim is to find their centrum. All the object are circles with a constant radius in the real world. But their are not perfectly represented in the map.
Here is an example of image that I have to process :
I'm using MATLAB 2009b.
Hough transform can be used to detect the shape of objects. You can use Matlab or OpenCv. Consider using the relevant GPU OpenCV if you are familiarized with gpu libs.
Good luck.

How to calculate perspective transformation using ellipse

I'm very new to 3D image processing.i'm working in my project to find the perspective angle of an circle.
A plate having set of white circles,using those circles i want to find the rotation angles (3D) of that plate.
For that i had finished camera calibration part and got camera error parameters.The next step i have captured an image and apply the sobel edge detection.
After that i have a little bit confusion about the ellipse fitting algorithm.i saw a lot of algorithms in ellipse fit.which one is the best method and fast method?
after finished ellipse fit i don't know how can i proceed further?how to calculate rotation and translation matrix using that ellipse?
can you tell me which algorithm is more suitable and easy. i need some matlab code to understand concept.
Thanks in advance
sorry for my English.
First, find the ellipse/circle centres (e.g. as Eddy_Em in other comments described).
You can then refer to Zhang's classic paper
https://research.microsoft.com/en-us/um/people/zhang/calib/
which allows you to estimate camera pose from a single image if some camera parameters are known, e.g. centre of projection. Note that the method fails for frontal recordings, i.e. the more of a perspective effect, the more accurate your estimate will be. The algorithm is fairly simple, you'll need a SVD and some cross products.

Matlab : Conversion of Triangular mesh to Regular (Square) Mesh

mI currently possess a triangular mesh model of a heart that is loaded into Matlab for further manipulation. The current problem is the that I require a regular (square) mesh model of the heart in order to perform proper texture mapping of an image. Can anyone provide a function or even another program that can convert the current TRIANGULAR mesh model to a regular SQUARE model? Thank you :)
I've had good results with the FEX submission GridTriMesh.